File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
src/main/java/io/reactivex/rxjava3/internal/queue Expand file tree Collapse 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) {
8787 public T poll () {
8888 LinkedQueueNode <T > currConsumerNode = lpConsumerNode (); // don't load twice, it's alright
8989 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 ;
9593 }
96- else if (currConsumerNode != lvProducerNode () ) {
94+ if (nextNode == null ) {
9795 // spin, we are no longer wait free
9896 while ((nextNode = currConsumerNode .lvNext ()) == null ) { } // NOPMD
9997 // 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 ;
10598 }
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 ;
107103 }
108104
109105 @ Override
You can’t perform that action at this time.
0 commit comments