Skip to content
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

ExecutionContext does not flow consistently #14

Closed
bman654 opened this issue Jul 2, 2014 · 2 comments
Closed

ExecutionContext does not flow consistently #14

bman654 opened this issue Jul 2, 2014 · 2 comments

Comments

@bman654
Copy link

bman654 commented Jul 2, 2014

See this Rx discussion thread for the full details.

But generally speaking, observables ExecutionContext from the notification source down to the observer. Observer callbacks fire within the notification source's execution context.

For cold observables, the 2 contexts are usually the same. But for hot observables, the 2 contexts can be different and it becomes unpredictable to know what context your callbacks will run in. And this flow direction tends to be counter-intuitive and doesn't really align with the way Tasks flow the execution context.

Should this behavior be changed?

@LeeCampbell
Copy link
Contributor

LeeCampbell commented Jul 18, 2014

In my opinion this is something in Rx that is better than in TPL. I find it quite offensive that TPL forces me to opt out of the implicit thread switching. Rx is free threaded by design, and I imagine many consumers would be shocked to see it change (as it is a breaking change). As a reminder some of us have been using Rx for +4 years and that would be quite a change to our code bases to have to unpick all the ExecutionContext switching this would introduce to get back our performance. I suggest looking at a solution using ObserverOn and a Scheduler that maintained Execution context.

@bartdesmet
Copy link
Collaborator

bartdesmet commented Apr 13, 2015

We've discussed this at length back in the day when we were designing Rx. Lee's explanation on the free threaded nature is spot on. In Rx, one has to explicitly parameterize concurrency using mechanisms such as ObserveOn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants