-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completable#concatWith(Completable) remove atomic operation #1000
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an interesting one.
We are using the same
Subscriber
instance across different sources. RS spec mentions that all methods of aSubscriber
must be invoked serially(Rule 1.3) and aSubscriber
should ensure delivery of signals happens-before processing of signals(Rule 2.11) however, there is no mention of a rule wheresubscribe()
should happen-before delivery of signals to theSubscriber
.So, here there is nothing guaranteeing from the spec that their is a memory barrier between call to
next.subscribeInternal(this)
andonComplete()
from the next source. So, it may be that we will seenextSubscribed
asfalse
and subscribe again.Interestingly I had this conversation before but it wasn't clear whether a rule is required to be added to the spec or existing rules cover this case. So 🍿 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall discussing this previously as well. IIUC the "shared subscriber" scenario is equivalent to the following:
If there is no happens-before relationship all non-final state in
MySubscriber
may not be visible when itsSubscriber
methods are invoked, which doesn't seem like desirable semantics from RS.Related considerations:
false
could happen at some later time and be visible after theSubscriber
has set the value totrue
.sequentialCancellable
in this class would also have the same issue (e.g. non final state used across subscribes).concat
operator implementations operate in the same way as this PR.Suggested path forward:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points about non-final state!
I have created this in RS:
reactive-streams/reactive-streams-jvm#486
And I agree we should go ahead with this change to make things consistent.