rook
invokeOnCompletion
launch(Dispatchers.Default) { val theJob = async(<http://Dispatchers.IO|Dispatchers.IO>) {} // do some work theJob.invokeOnCompletion { println() } }
do some work
theJob
Dispatchers.Default
<http://Dispatchers.IO|Dispatchers.IO>
diesieben07
Note: Implementation of CompletionHandler must be fast, non-blocking, and thread-safe. This handler can be invoked concurrently with the surrounding code. There is no guarantee on the execution context in which the handler is invoked.
A modern programming language that makes developers happier.