-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Lock-free subscriptions #593
Lock-free subscriptions #593
Conversation
It cannot return Subscriptions.empty(), since the Rx contract is to return null. Also, returning empty() when unsubscribed is ambiguous: has it been unsubscribed or has empty() been set by the client code ? |
RxJava-pull-requests #527 SUCCESS |
Good that you fixed the race condition in MultipleAssignementSubscription as well as the contract. (it was unsubscribing the previous subscription although it shouldn't) |
I've checked the Rx.NET sources:
So my question is, why only SerialDisposable returns null? Checking the return of the getSubscription to determine if unsubscription happened is wrong since SerialSubscription can be started with null; this is why |
I don't think that is actually this strict; that is what the implementation does; I think it is better to return empty than null. The real "state" is is isUnsubscribed (and the properties might as well be write-only) |
I think the disposable / subscription contract lakes precision and uniformity. It doesn't matter to return null or empty, what matters is a constant behavior, following the "least astonishment" principle |
Lock-free subscriptions
Lock-free subscriptions
Remarks: