Skip to content

Conversation

@akarnokd
Copy link
Contributor

@akarnokd akarnokd commented Apr 6, 2017

The original version was prone to lose the final item in case of an unfortunate interleaving:

Drain thread Source thread ----------------------------------------- elementRef.get() != null request(1) onNext(item) -> elementRef.lazySet(item) onComplete() -> terminated = true; if (terminated) emitter.complete() 

The emitter is completed but the "queue" still holds the final element that will never be emitted.

@rstoyanchev
Copy link
Contributor

Oops, good point! I added a comment so that doesn't get "lost" accidentally again.

@rstoyanchev rstoyanchev closed this Apr 6, 2017
@akarnokd akarnokd deleted the AbstractEmitterSubscriberFix2 branch April 6, 2017 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants