File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
src/main/java/io/reactivex/rxjava3/internal/queue Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,23 @@ 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- final T nextValue ;
91- if (nextNode == null && currConsumerNode == lvProducerNode ()) {
92- return null ;
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 ;
9395 }
94- if (nextNode == null ) {
96+ else if (currConsumerNode != lvProducerNode () ) {
9597 // spin, we are no longer wait free
9698 while ((nextNode = currConsumerNode .lvNext ()) == null ) { } // NOPMD
9799 // 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 ;
98105 }
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 ;
106+ return null ;
103107 }
104108
105109 @ Override
You can’t perform that action at this time.
0 commit comments