Releases: Kotlin/kotlinx.coroutines
Releases · Kotlin/kotlinx.coroutines
0.24.0
- Fully multiplatform release with Kotlin/Native support (see #246):
- Only single-threaded operation inside
runBlockingevent loop is supported at this moment. - See details on setting up build environment here.
- Only single-threaded operation inside
- Improved channels:
- Provides
BlockingCheckermechanism which checks current context (see #227).- Attempts to use
runBlockingfrom any supported UI thread (Android, JavaFx, Swing) will result in exception.
- Attempts to use
- Android:
- Worked around Android bugs with zero-size ForkJoinPool initialization (see #432, #288).
- Introduced
UI.immediateextension as performance-optimization to immediately execute tasks which are invoked from the UI thread (see #381).- Use it only when absolutely needed. It breaks asynchrony of coroutines and may lead to surprising and unexpected results.
- Fixed materialization of a
causeexception forJobonCancelling handlers (see #436). - Fixed JavaFx
UIon Java 9 (see #443). - Fixed and documented the order between cancellation handlers and continuation resume (see #415).
- Fixed resumption of cancelled continuation (see #450).
- Includes multiple fixes to documentation contributed by @paolop, @sahillone, @rocketraman, @bdavisx, @mtopolnik, @Groostav.
- Experimental coroutines scheduler preview (JVM only):
- Written from scratch and optimized for communicating coroutines.
- Performs significantly better than ForkJoinPool on coroutine benchmarks and for connected applications with ktor.
- Supports automatic creating of new threads for blocking operations running on the same thread pool (with an eye on solving #79), but there is no stable public API for it just yet.
- For preview, run JVM with
-Dkotlinx.coroutines.scheduleroption. In this caseDefaultDispatcheris set to new experimental scheduler instead of FJP-basedCommonPool. - Submit your feedback to issue #261.
0.23.4
0.23.3
0.23.2
0.23.1
- JS: Fix dependencies in NPM: add "kotlinx-atomicfu" dependency (see #370).
- Introduce
broadcastcoroutine builder (see #280):- Support
BroadcastChannel.cancelmethod 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:
CancellableContinuationis not aJobanymore (see #219):- It does not affect casual users of
suspendCancellableCoroutine, since all the typically used functions are still there. CancellableContinuation.invokeOnCompletionis deprecated now and its semantics had subtly changed:invokeOnCancellationis a replacement forinvokeOnCompletionto install a handler.- The handler is not invoked on
resumewhich corresponds to the typical usage pattern. - There is no need to check for
cont.isCancelledin 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
CancellableContinuationimplementation 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
coroutineContextfunction from Kotlin standard library.
- It is replaced with top-level
- Improve
ReceiveChanneloperators implementations to guarantee closing of the source channels under all circumstances (see #279):onCompletionparameter added toproduceand all other coroutine builders.- Introduce
ReceiveChannel.consumes(): CompletionHandlerextension function.
- Replace
SubscriptionReceiveChannelwithReceiveChannel(see #283, PR by @deva666).ReceiveChannel.useextension is introduced to preserve source compatibility, but is deprecated.consumeorconsumeEachextensions 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
awaitAllandjoinAllforDeferredandJoblists correspondingly (see #171). - Unwrap
CompletionExceptionexception inCompletionStage.awaitslow-path to provide consistent results (see #375). - Add extension to
ExecutorServiceto 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,withTimeoutandonTimeout(see #310). - Fix a few bugs (leaks on cancellation) in
delay:- Invoke
clearTimeouton cancellation in JSDispatcher. - Remove delayed task on cancellation from internal data structure on JVM.
- Invoke
- Introduce
tickerfunction to create "ticker channels" (see #327):- It provides analogue of RX
Observable.timerfor 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.DEBUGvalue (see #316, PR by @dmytrodanylyk):- Made
CoroutineContext.DEBUG_PROPERTY_NAMEconstant public. - Introduce public constants with
"on","off","auto"values.
- Made
- Introduce system property to control
CommonPoolparallelism (see #343):CommonPool.DEFAULT_PARALLELISM_PROPERTY_NAMEconstant 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
producebuilder to close the channel on completion instead of cancelling it, which lead to lost elements with buffered channels (see #256). - Don't use
ForkJoinPoolif there is aSecurityManagerpresent to work around JNLP problems (see #216, PR by @NikolayMetchev). - JS: Check for undefined
window.addEventListenerwhen 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
awaitFirstOrDefaultandawaitFirstOrNullextensions (see #224, PR by @konrad-kaminski). - Core: Fixed
withTimeoutandwithTimeoutOrNullthat 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.