| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
7b14046dc70bd6c00de7b2dc56a93c3d03925e86
Change-Id: I848f30a15f99f2a06e1a3c3bcf15881c9d9db0f1
|
|
|
|
|
|
|
|
| |
This reverts commit b4c8c9ba7d6064a126ae0cb67f4f271f4e4a885a.
Reason for revert: b/187908823
Change-Id: I171329d6b9b8c3fb2087097d4ed934f7384ffebf
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
# Conflicts:
# README.md
# coroutines-guide.md
# docs/basics.md
# docs/cfg/buildprofiles.xml
# docs/kc.tree
# docs/topics/coroutines-basic-jvm.md
# docs/topics/coroutines-guide.md
# docs/topics/debugging.md
# docs/topics/knit.properties
|
| |
| |
| |
| | |
* update: rename basics.md to coroutines-basics.md
* update: add fix for correct page indexing
|
| | |
|
| |
| |
| |
| |
| |
| | |
* Restore the context in the reverse order of update, so they are properly nested into each other
Fixes #2195
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fix solves the problem of restoring thread-context when
returning to another context in an undispatched way.
It impacts suspend/resume performance of coroutines that use ThreadContextElement and undispatched coroutines.
The kotlinx.coroutines code poisons the context with special 'UndispatchedMarker' element and linear lookup is performed only when the marker is present. The code also contains a description of an alternative approach in order to save a linear lookup in complex coroutines hierarchies.
Fast-path of coroutine resumption is slowed down by a single context lookup.
Fixes #985
Co-authored-by: Roman Elizarov <elizarov@gmail.com>
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
| |
| |
| |
| | |
order to get prettier stacktraces without "$kotlinx_coroutines_core" in function names (#2487)
|
| |
| |
| | |
Fixes https://github.com/Kotlin/kotlinx.coroutines/issues/1437
|
| |
| |
| | |
Signed-off-by: slavon <v.badalyan@open-bs.ru>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Fix incorrect ProGuard rules that allowed shrinking volatile felds
Fixes #1564
* Modify ProGuard rules to only affect `kotlinx.coroutines.**`
Before, some rules were applied to a wide range of libraries for no good reason.
Now, they are limited to this library.
|
| |
| |
| |
| |
| |
| | |
* Remove explicit API mode suppressions
* Use list build in ReceiveChannel.toList to prevent casting to mutable list
* Migrate to maxByOrNull
* Remove redundant nullabilities
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Remove the requirement that the job of the pre-created JobCancelNode have to be equal to the outer job
Job is supposed to be "sealed" interface, but we also have non-sealed Deferred that can be successfully implemented via delegation and such delegation may break code (if assertions are enabled!) in very subtle ways.
This assertion is our internal invariant that we're preserving anyway, so it's worth to lift it to simplify the life of our users in the future
Fixes #2423
Co-authored-by: Roman Elizarov <elizarov@gmail.com>
|
| |
| |
| |
| |
| |
| | |
* Rework publish-mpp-root-module-in-platform.gradle
* Update stackwalking tests
Co-authored-by: anastasiia.spaseeva <anastasiia.spaseeva@jetbrains.com>
|
|/
|
|
|
| |
* Add the model checking mode to Lincheck tests and use a newer and faster version of it
Co-authored-by: Roman Elizarov <elizarov@gmail.com>
|
|
|
|
|
|
|
|
| |
* Add build parameters to enable JVM IR and disable native targets
* enable_jvm_ir enables JVM IR compiler
* disable_native_targets disables native targets in train builds
* enable_jvm_ir_api_check enables JVM IR API check (works only if enable_jvm_ir is set)
* Fix "Return type must be specified in explicit API mode" in 1.4.20
|
|
|
|
|
|
|
|
| |
slow-path in Mutex/Semaphore (#2396)
Fixes #2390
Co-authored-by: Gareth Pearce <Tilps@users.noreply.github.com>
|
|
|
|
|
| |
(#2377)
Fixes #2371
|
| |
|
|
|
|
|
|
|
|
| |
subscriber (#2359)
* Added a specific test for a problematic scenario.
* Added stress test with concurrent emitters and subscribers that come and go.
Fixes #2356
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Gracefully increase deprecation level on Channel operators instead of removing them, a warning was not strict enough
* Remove hidden onCompletion from -M release
* Promote StateFlow and SharedFlow to stable API
* Lift out experimentality where it is applicable
* CoroutineDispatcher.invoke
* ReceiveChannel.consume and ReceiveChannel.consumeEach
* Flow core operators: onStart, onCompletion, onEmpty
* CompletableDeferred.completeWith
* awaitCancellation
* Add experimentality notes where applicable
|
|
|
|
| |
Co-authored-by: Miguel Kano <miguel.g.kano@gmail.com>
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
|
|
|
| |
* Do not use invokeSafely in onCompletion
Co-authored-by: Roman Elizarov <elizarov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Rework Flow.zip operator: improve its performance by 40%, collect one of the upstreams in the same coroutine as emitter
* Rework Flow.combine
* Get rid of two code paths
* Get rid of accidental O(N^2) where N is the number of flows that caused #2296
* Get rid of select that hits performance hard, improving performance by 50% in the pessimistic case
* Get rid of crossinlines in API and implementation to fix Android issues
* Make combine fairer and its results less surprising in sequential scenarios
* Improve stacktrace recovery and stackwalking for SafeCollector, flowOn and zip operators
* Update JMH
Fixes #1743
Fixes #1683
Fixes #2296
|
|
|
| |
Fixes #2159
|
|
|
|
| |
access properties in a safe manner from agent premain instead (#2311)
|
|
|
|
|
| |
Cleanup lazy coroutines that have been cancelled but not yet garbage collected
Fixes #2294
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Introduce SharedFlow and sharing operators
Summary of changes:
* SharedFlow, MutableSharedFlow and its constructor.
* StateFlow implements SharedFlow.
* SharedFlow.onSubscription operator, clarified docs in other onXxx operators.
* BufferOverflow strategy in kotlinx.coroutines.channels package.
* shareIn and stateIn operators and SharingStarted strategies for them.
* SharedFlow.flowOn error lint (up from StateFlow).
* Precise cancellable() operator fusion.
* Precise distinctUntilChanged() operator fusion.
* StateFlow.compareAndSet function.
* asStateFlow and asSharedFlow read-only view functions.
* Consistently clarified docs on cold vs hot flows.
* Future deprecation notice for BroadcastChannel, ConflatedBroadcastChannel, broadcast, and broadcastIn.
* Channel(...) constructor function has onBufferOverflow parameter.
* buffer(...) operator has onBufferOverflow parameter.
* shareIn/stateIn buffer and overflow strategy are configured via upstream buffer operators.
* shareIn/stateIn fuse with upstream flowOn for more efficient execution.
* conflate() is implemented as buffer(onBufferOverflow=KEEP_LATEST), non-suspending strategies are reasonably supported with 0 and default capacities.
* Added reactive operator migration hints.
* WhileSubscribed with kotlin.time.Duration params
Fixes #2034
Fixes #2047
Co-authored-by: Ibraheem Zaman <1zaman@users.noreply.github.com>
Co-authored-by: Thomas Vos <thomasjsvos@gmail.com>
Co-authored-by: Travis Wyatt <travis.i.wyatt@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a problematic for Android when Main dispatcher is cancelled on destroyed activity.
Atomic nature of channels is designed to prevent loss of elements,
which is really not an issue for a typical application, but creates problem when used with channels.
* Internal suspendAtomicCancellableCoroutine -> suspendCancellableCoroutine
* Internal suspendAtomicCancellableCoroutineReusable -> suspendCancellableCoroutineReusable
* Remove atomic cancellation from docs
* Ensures that flowOn does not resume downstream after cancellation.
* MODE_ATOMIC_DEFAULT renamed into MODE_ATOMIC
* Introduced MODE_CANCELLABLE_REUSABLE to track suspendCancellableCoroutineReusable
* Better documentation for MODE_XXX constants.
* Added stress test for proper handling of MODE_CANCELLABLE_REUSABLE
and fixed test for #1123 bug with job.join (working in MODE_CANCELLABLE) that was not
properly failing in the absence of the proper code in CancellableContinuationImpl.getResult
* Added test for Flow.combine that should be fixed
* Support extended invokeOnCancellation contract
* Introduced internal tryResumeAtomic
* Channel onUnderliveredElement is introduced as a replacement.
Fixes #1265
Fixes #1813
Fixes #1915
Fixes #1936
Co-authored-by: Louis CAD <louis.cognault@gmail.com>
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
|
|
|
| |
When the Executor that was used with Executor.asCoroutineDispatcher() extension rejects the submitted task, it means that it had reached its capacity and so the executing current Job should be canceled to terminate it as soon as possible. This way RejectedExecutionException works as a rate-limiter just like it serves this purpose in executor-based Java code.
Fixes #2003
|
|
|
|
|
| |
This is a tricky gotcha that needs additional explanation. There are two examples added, one showing the bad code and explaining why it does not work, and the other showing the correct way to write it.
Fixes #2233
|
|
|
|
|
|
| |
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit.
* Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too.
Fixes #2243
|
|
|
| |
Fixes #2272
|
|
|
|
| |
Fixes #2046
Fixes #2266
|
|
|
|
| |
* Immediate dispatcher on JS, test added
* Style fixes
|
| |
|
| |
|
|
|
|
|
| |
The test is improved so that it fails, not hangs, on a failure. However, it will not pass on Windows + JDK 1.6 due to a bug in JDK (which can be easily confirmed with this modification to a test), so it excluded when running on JDK 1.6.
Fixes #2144
|
|
|
|
|
|
|
|
|
|
|
|
| |
It should not prevent garbage-collection of coroutines that were otherwise lost, which included the following practically-useful cases:
* Synchronous coroutines (iterator/sequence).
* Lazy coroutines that were not started.
* Abandoned coroutines that suspend forever without strong references to them in GlobalScope.
Two kinds of tests cover this functionality:
* A test via FieldWalker ensures that debugger impl does not keep a strong reference. This tests works fast and provides good diagnostics if anything goes wrong, but it is fragile, as futures changes to debugger my introduce static references to running coroutines elsewhere.
* A stress-test that ensures that no OOM indeed happens when you run a lot of such lost coroutines. Longer-running, more stable to code change, but fragile in a difference sense as it may accidentally start passing in the future if lots of memory get allocated for tests.
Fixes #2117
|
|
|
| |
Fixes #2135
|
|
|
|
| |
So that is shows as "Dispatchers.Main" and "Dispatchers.Main.immediate".
Also remove hardcoded "Main" name in places of code where it is not needed anymore.
|
|\ |
|
| |
| |
| | |
The name 'foo' might be hard to get for novice developers. It is really hard to find a "meaningful" name for all examples in the docs, so this is simply a consistent solution. The alternative is to something like "simpleFlow", but adding a "Flow" suffix to the name implicitly condones Hungarian notation, which is not aligned with Kotlin coding style.
|
|\| |
|
| |
| |
| |
| | |
Co-authored-by: Louis CAD <louis.cognault@gmail.com>
|
|\| |
|
| |
| |
| | |
Fixes #2062
|