A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ReactiveX/RxJava/commit/b8582b93f8509c846693215b6a23b15272b9d72c below:

Refactor MpscLinkedQueue.poll · ReactiveX/RxJava@b8582b9 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-12

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-12

lines changed Original file line number Diff line number Diff line change

@@ -87,23 +87,19 @@ public boolean offer(final T e) {

87 87

public T poll() {

88 88

LinkedQueueNode<T> currConsumerNode = lpConsumerNode(); // don't load twice, it's alright

89 89

LinkedQueueNode<T> nextNode = currConsumerNode.lvNext();

90 -

if (nextNode != null) {

91 -

// we have to null out the value because we are going to hang on to the node

92 -

final T nextValue = nextNode.getAndNullValue();

93 -

spConsumerNode(nextNode);

94 -

return nextValue;

90 +

final T nextValue;

91 +

if (nextNode == null && currConsumerNode == lvProducerNode()) {

92 +

return null;

95 93

}

96 -

else if (currConsumerNode != lvProducerNode()) {

94 +

if (nextNode == null) {

97 95

// spin, we are no longer wait free

98 96

while ((nextNode = currConsumerNode.lvNext()) == null) { } // NOPMD

99 97

// got the next node...

100 - 101 -

// we have to null out the value because we are going to hang on to the node

102 -

final T nextValue = nextNode.getAndNullValue();

103 -

spConsumerNode(nextNode);

104 -

return nextValue;

105 98

}

106 -

return null;

99 +

// we have to null out the value because we are going to hang on to the node

100 +

nextValue = nextNode.getAndNullValue();

101 +

spConsumerNode(nextNode);

102 +

return nextValue;

107 103

}

108 104 109 105

@Override

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4