kotlinx.coroutines v0.17 Release Notes
-
- ๐
CompletableDeferred
is introduced as a set-once event-like communication primitive (see #70).- [Coroutines guide](docs/topics/coroutines-guide.md) uses it in a section on actors.
CompletableDeferred
is an interface with private impl (courtesy of @fvasco, see #86).- It extends
Deferred
interface withcomplete
andcompleteExceptionally
functions.
- ๐
Job.join
andDeferred.await
wait until a cancelled coroutine stops execution (see #64).Job
andDeferred
have a new cancelling state which they enter on invocation ofcancel
.Job.invokeOnCompletion
has an additional overload withonCancelling: Boolean
parameter to install handlers that are fired as soon as coroutine enters cancelling state as opposed to waiting until it completes.- Internal
select
implementation is refactored to decouple it fromJobSupport
internal class and to optimize its state-machine. - Internal
AbstractCoroutine
class is refactored so that it is extended only by true coroutines, all of which support the new cancelling state.
CoroutineScope.context
is renamed tocoroutineContext
to avoid conflicts with other usages ofcontext
in applications (like Android context, see #75).- ๐
BroadcastChannel.open
is renamed toopenSubscription
(see #54). - ๐ Fixed
StackOverflowError
in a convoy ofMutex.unlock
invokers withUnconfined
dispatcher (see #80). - ๐ Fixed
SecurityException
when trying to use coroutines library with installedSecurityManager
. - ๐ Fixed a bug in
withTimeoutOrNull
in case with nested timeouts when coroutine was cancelled before it was ever suspended. - ๐ Fixed a minor problem with
awaitFirst
on reactive streams that would have resulted in spurious stack-traces printed on the console when used with publishers/observables that continue to invokeonNext
despite being cancelled/disposed (which they are technically allowed to do by specification). - All factory functions for various interfaces are implemented as top-level functions
(affects
Job
,Channel
,BroadcastChannel
,Mutex
,EventLoop
, andCoroutineExceptionHandler
). Previous approach of usingoperator invoke
on their companion objects is deprecated. - Nicer-to-use debug
toString
implementations for coroutine dispatcher tasks and continuations. - 0๏ธโฃ A default dispatcher for
delay
is rewritten and now shares code withEventLoopImpl
that is used byrunBlocking
. It internally supports non-defaultTimeSource
so that delay-using tests can be written with "virtual time" by replacing their time source for the duration of tests (this feature is not available outside of the library).
- ๐