kotlinx.coroutines v0.15 Release Notes
-
- Switched to Kotlin version 1.1.2 (can still be used with 1.1.0).
- ๐
CoroutineStart
enum is introduced forlaunch
/async
/actor
builders:- The usage of
luanch(context, start = false)
is deprecated and is replaced withlaunch(context, CoroutineStart.LAZY)
CoroutineStart.UNDISPATCHED
is introduced to start coroutine execution immediately in the invoker thread, so thatasync(context, CoroutineStart.UNDISPATCHED)
is similar to the behavior of C#async
.- [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md) mentions the use of it to optimize the start of coroutines from UI threads.
- The usage of
- Introduced
BroadcastChannel
interface inkotlinx-coroutines-core
module:- It extends
SendChannel
interface and providesopen
function to create subscriptions. - Subscriptions are represented with
SubscriptionReceiveChannel
interface. - The corresponding
SubscriptionReceiveChannel
interfaces are removed from [reactive](reactive) implementation modules. They use an interface defined inkotlinx-coroutines-core
module. ConflatedBroadcastChannel
implementation is provided for state-observation-like use-cases, where a coroutine or a regular code (in UI, for example) updates the state that subscriber coroutines shall react to.ArrayBroadcastChannel
implementation is provided for event-bus-like use-cases, where a sequence of events shall be received by multiple subscribers without any omissions.- [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md) includes "Rx Subject vs BroadcastChannel" section.
- It extends
- ๐ Pull requests from Konrad Kamiลski are merged into reactive stream implementations:
- Support for Project Reactor
Mono
andFlux
. See [kotlinx-coroutines-reactor
](reactive/kotlinx-coroutines-reactor) module. - Implemented Rx1
Completable.awaitCompleted
. - Added support for Rx2
Maybe
.
- Support for Project Reactor
- ๐ Better timeout support:
- Introduced
withTimeoutOrNull
function. - Implemented
onTimeout
clause forselect
expressions. - Fixed spurious concurrency inside
withTimeout
blocks on their cancellation. - Changed behavior of
withTimeout
whenCancellationException
is suppressed inside the block. Invocation ofwithTimeout
now always returns the result of execution of its inner block.
- Introduced
- The
channel
property inActorScope
is promoted to a widerChannel
type, so that an actor can have an easy access to its own inbox send channel. - ๐ Renamed
Mutex.withMutex
toMutex.withLock
, old name is deprecated.