CoRoutine Gotchas
From Cancellation Gotchas (With Regular Job)
Go to text →
- ⚠️ Firstly, make sure to understand intended Exception/Cancellation Behavior with Regular Job ⚠️.
- ⚠️ Swallowing cancellation exception prevents cancellation ⚠️
- ⚠️ Unhandled exception from async can go to parent scope without going through await() ⚠️
- ⚠️ cancel() call stops on next suspension point, NOT right away ⚠️
- ⚠️ join() does NOT rethrow ⚠️
From scope functions gotchas
Go to text →
From building-scope-gotchas
Go to text →
From withTimeout gotchas
Go to text →
Job is not inherited: it is used as a parent
DONT:
runBlocking(SupervisorJob())
makes no sense. pg 433.
Children
- Benchmarking against Thread Pool
- Benchmarking in Native
- Co routines invocations will wait for the background thread to finish even if result is not used right away.
- Delay Can Take Longer than requested
- Even with Async Await Io Dispatcher Not Using up All Cores
- Initial Run Blocking Takes Upwards of 100ms
Backlinks