kotlinx.coroutines v0.26.0 Release Notes
-
- ๐ Major rework of
kotlinx.coroutines
concurrency model (see #410 for a full explanation of the rationale behind this change):- All coroutine builders are now extensions on
CoroutineScope
and inherit itscoroutineContext
. Standalone builders are deprecated. - As a consequence, all nested coroutines launched via builders now automatically establish parent-child relationship and inherit
CoroutineDispatcher
. - All coroutine builders use
Dispatchers.Default
by default ifCoroutineInterceptor
is not present in their context. - CoroutineScope became the first-class citizen in
kolinx.coroutines
. withContext
block
argument hasCoroutineScope
as a receiver.- GlobalScope is introduced to simplify migration to new API and to launch global-level coroutines.
currentScope
andcoroutineScope
builders are introduced to extract and provideCoroutineScope
.- Factory methods to create
CoroutineScope
fromCoroutineContext
are introduced. CoroutineScope.isActive
became an extension property.- New sections about structured concurrency in core guide: ["Structured concurrency"](docs/topics/coroutines-guide.md#structured-concurrency), ["Scope builder"](docs/topics/coroutines-guide.md#scope-builder) and ["Structured concurrency with async"](docs/topics/coroutines-guide.md#structured-concurrency-with-async).
- New section in UI guide with Android example: ["Structured concurrency, lifecycle and coroutine parent-child hierarchy"](ui/coroutines-guide-ui.md#structured-concurrency,-lifecycle-and-coroutine-parent-child-hierarchy).
- Deprecated reactive API is removed.
- All coroutine builders are now extensions on
- ๐ Dispatchers are renamed and grouped in the Dispatchers object (see #41 and #533):
- Dispatcher names are consistent.
- Old dispatchers including
CommonPool
are deprecated.
- ๐ Fixed bug with JS error in rare cases in
invokeOnCompletion(onCancelling = true)
. - ๐ Fixed loading of Android exception handler when
Thread.contextClassLoader
is mocked (see #530). - ๐ Fixed bug when
IO
dispatcher silently hung (see #524 and #525) .
- ๐ Major rework of