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

Callback received in Task.create should be thread-safe and should shift back to default Scheduler #917

Merged
merged 17 commits into from Aug 1, 2019

Conversation

@alexandru
Copy link
Member

commented Jun 20, 2019

Changes in these PR:

  • in attempting to investigate #908, it became clear that the Callback passed in Task.async (and variants) should be thread-safe
    • this should be the user's responsibility, but in case the user fails to uphold the contract, it falls on us to investigate potential bugs and it creates frustration for the user
    • in case onSuccess / onError are called twice, an IllegalStateException is still being thrown, the difference is that now this conflict is able to be detected in a multi-threading context
    • this should give us or the users better error messages
  • removing the allowContinueOnCallingThread flag on Task.async, Task.cancelable, Task.create, etc... introduced in #921
    • we don't need this flag
    • this is now replaced with a cool optimization that detects if the register function actually forks and if so, then we shift back, if not then we don't shift
  • also changesTask.fromFuture to use Future.onComplete as it was meant to be used
alexandru added 4 commits Jun 20, 2019
@alexandru

This comment has been minimized.

Copy link
Member Author

commented Jun 20, 2019

Released test version: 3.0.0-RC2-cb74787

@alexandru alexandru added this to the 3.0.0 milestone Jul 28, 2019

@alexandru alexandru changed the title WIP: issue #908 test Callback received in Task.async should be thread-safe Jul 28, 2019

alexandru added 3 commits Jul 28, 2019

@alexandru alexandru changed the title Callback received in Task.async should be thread-safe [WIP] Callback received in Task.create should be thread-safe and should shift back to default Scheduler Jul 28, 2019

alexandru added 2 commits Jul 28, 2019

@alexandru alexandru changed the title [WIP] Callback received in Task.create should be thread-safe and should shift back to default Scheduler Callback received in Task.create should be thread-safe and should shift back to default Scheduler Jul 28, 2019

project/MimaFilters.scala Outdated Show resolved Hide resolved
alexandru added 6 commits Jul 31, 2019

@alexandru alexandru merged commit a2c66b0 into monix:master Aug 1, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.