1.x: fix Spsc queues reporting not empty but then poll() returns null by akarnokd · Pull Request #4005 · ReactiveX/RxJava · GitHub
Skip to content

1.x: fix Spsc queues reporting not empty but then poll() returns null#4005

Merged
akarnokd merged 1 commit into
ReactiveX:1.xfrom
akarnokd:SpscQueueFixes
Jun 15, 2016
Merged

1.x: fix Spsc queues reporting not empty but then poll() returns null#4005
akarnokd merged 1 commit into
ReactiveX:1.xfrom
akarnokd:SpscQueueFixes

Conversation

@akarnokd

@akarnokd akarnokd commented Jun 13, 2016

Copy link
Copy Markdown
Member

In the spsc queues, the indexes were written before the actual elements and thus a concurrent isEmpty check would report a non-empty queue but a poll would still return null. The fix swaps the two writes.

Note that this an inconsistency in the original JCTools code and not the lack of keeping up with it.

@artem-zinnatullin

artem-zinnatullin commented Jun 13, 2016

Copy link
Copy Markdown
Contributor

1 similar comment
@stevegury

Copy link
Copy Markdown
Member

@akarnokd akarnokd merged commit 3261a49 into ReactiveX:1.x Jun 15, 2016
@akarnokd akarnokd deleted the SpscQueueFixes branch June 15, 2016 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants