Releases: Kotlin/kotlinx.coroutines
Releases · Kotlin/kotlinx.coroutines
0.23.3
0.23.2
0.23.1
- JS: Fix dependencies in NPM: add "kotlinx-atomicfu" dependency (see #370).
- Introduce
broadcast
coroutine builder (see #280):- Support
BroadcastChannel.cancel
method to drop the buffer. - Introduce
ReceiveChannel.broadcast()
extension.
- Support
- Fixed a bunch of doc typos (PRs by @paolop).
- Corrected previous version's release notes (PR by @ansman).
0.23.0
- Kotlin 1.2.41
- Coroutines core module is made mostly cross-platform for JVM and JS:
- Migrate channels and related operators to common, so channels can be used from JS (see #201).
- Most of the code is shared between JVM and JS versions using cross-platform version of AtomicFU library.
- The recent version of Kotlin allows default parameters in common code (see #348).
- The project is built using Gradle 4.6.
- Breaking change:
CancellableContinuation
is not aJob
anymore (see #219):- It does not affect casual users of
suspendCancellableCoroutine
, since all the typically used functions are still there. CancellableContinuation.invokeOnCompletion
is deprecated now and its semantics had subtly changed:invokeOnCancellation
is a replacement forinvokeOnCompletion
to install a handler.- The handler is not invoked on
resume
which corresponds to the typical usage pattern. - There is no need to check for
cont.isCancelled
in a typical handler code anymore (since handler is invoked only when continuation is cancelled). - Multiple cancellation handlers cannot be installed.
- Cancellation handlers cannot be removed (disposed of) anymore.
- This change is designed to allow better performance of suspending cancellable functions:
- Now
CancellableContinuation
implementation has simpler state machine and is implemented more efficiently.
- Now
- Exception handling in
AbstractContinuation
(that implementsCancellableContinuation
) is now consistent:- Always prefer exception thrown from coroutine as exceptional reason, add cancellation cause as suppressed exception.
- It does not affect casual users of
- Big change: Deprecate
CoroutineScope.coroutineContext
:- It is replaced with top-level
coroutineContext
function from Kotlin standard library.
- It is replaced with top-level
- Improve
ReceiveChannel
operators implementations to guarantee closing of the source channels under all circumstances (see #279):onCompletion
parameter added toproduce
and all other coroutine builders.- Introduce
ReceiveChannel.consumes(): CompletionHandler
extension function.
- Replace
SubscriptionReceiveChannel
withReceiveChannel
(see #283, PR by @deva666).ReceiveChannel.use
extension is introduced to preserve source compatibility, but is deprecated.consume
orconsumeEach
extensions should be used for channels.- When writing operators,
produce(onCompletion=consumes()) { ... }
pattern shall be used (see #279 above).
- JS: Kotlin is declared as peer dependency (see #339, #340, PR by @ansman).
- Invoke exception handler for actor on cancellation even when channel was successfully closed, so exceptions thrown by actor are always reported (see #368).
- Introduce
awaitAll
andjoinAll
forDeferred
andJob
lists correspondingly (see #171). - Unwrap
CompletionException
exception inCompletionStage.await
slow-path to provide consistent results (see #375). - Add extension to
ExecutorService
to returnCloseableCoroutineDispatcher
(see #278, PR by @deva666). - Fail with proper message during build if JDK_16 is not set (see #291, PR by @venkatperi).
- Allow negative timeouts in
delay
,withTimeout
andonTimeout
(see #310). - Fix a few bugs (leaks on cancellation) in
delay
:- Invoke
clearTimeout
on cancellation in JSDispatcher. - Remove delayed task on cancellation from internal data structure on JVM.
- Invoke
- Introduce
ticker
function to create "ticker channels" (see #327):- It provides analogue of RX
Observable.timer
for coroutine channels. - It is currently supported on JVM only.
- It provides analogue of RX
- Add a test-helper class
TestCoroutineContext
(see #297, PR by @streetsofboston).- It is currently supported on JVM only.
- Ticker channels (#327) are not yet compatible with it.
- Implement a better way to set
CoroutineContext.DEBUG
value (see #316, PR by @dmytrodanylyk):- Made
CoroutineContext.DEBUG_PROPERTY_NAME
constant public. - Introduce public constants with
"on"
,"off"
,"auto"
values.
- Made
- Introduce system property to control
CommonPool
parallelism (see #343):CommonPool.DEFAULT_PARALLELISM_PROPERTY_NAME
constant is introduced with a value of "kotlinx.coroutines.default.parallelism".
- Include package-list files into documentation site (see #290).
- Fix various typos in docs (PRs by @paolop and @ArtsiomCh).
0.22.5
0.22.4
0.22.3
- Fixed
produce
builder to close the channel on completion instead of cancelling it, which lead to lost elements with buffered channels (see #256). - Don't use
ForkJoinPool
if there is aSecurityManager
present to work around JNLP problems (see #216, PR by @NikolayMetchev). - JS: Check for undefined
window.addEventListener
when choosing default coroutine dispatcher (see #230, PR by @ScottPierce). - Update 3rd party dependencies:
- kotlinx-coroutines-rx1 to RxJava version
1.3.6
. - kotlinx-coroutines-rx2 to RxJava version
2.1.9
. - kotlinx-coroutines-guava to Guava version
24.0-jre
.
- kotlinx-coroutines-rx1 to RxJava version
0.22.2
- Android: Use Keep annotation on AndroidExceptionPreHandler to fix the problem on Android with minification enabled (see #214).
- Reactive: Added
awaitFirstOrDefault
andawaitFirstOrNull
extensions (see #224, PR by @konrad-kaminski). - Core: Fixed
withTimeout
andwithTimeoutOrNull
that should not use equals on result (see #212, PR by @konrad-kaminski). - Core: Fixed hanged receive from a closed subscription of BroadcastChannel (see #226).
- IO: fixed error propagation (see ktorio/ktor#301)
- Include common sources into sources jar file to work around KT-20971.
- Fixed bugs in documentation due to MPP.
0.22.1
- Migrated to Kotlin 1.2.21.
- Improved
actor
builder documentation (see #210) and fixed bugs in rendered documentation due to multiplatform. - Fixed
runBlocking
to properly support specified dispatchers (see #209). - Fixed data race in
Job
implementation (it was hanging atLockFreeLinkedList.helpDelete
on certain stress tests). AbstractCoroutine.onCancellation
is invoked before cancellation handler that is set viainvokeOnCompletion
.- Ensure that
launch
handles uncaught exception before another coroutine that usesjoin
on it resumes (see #208).
0.22
- Migrated to Kotlin 1.2.20
- Introduced stable public API for
AbstractCoroutine
:- Implements
Job
,Continuation
, andCoroutineScope
. - Has overridable
onStart
,onCancellation
,onCompleted
andonCompletedExceptionally
functions. - Reactive integration modules are now implemented using public API only.
- Notifies onXXX before all the installed handlers, so
launch
handles uncaught exceptions before "joining" coroutines wakeup (see #208).
- Implements