Skip to content

Commit e727cee

Browse files
committed
yield behavior w.r.t. cancellation is clarified in docs
1 parent 01934df commit e727cee

File tree

1 file changed

+3
-3
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental

1 file changed

+3
-3
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Yield.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package kotlinx.coroutines.experimental
33
/**
44
* Yields a thread (or thread pool) of the current coroutine dispatcher to other coroutines to run.
55
* If the coroutine dispatcher does not have its own thread pool (like [Here] dispatcher) then this
6-
* function does nothing, but checks if the coroutine [Job] was cancelled.
6+
* function does nothing, but checks if the coroutine [Job] was completed.
77
* This suspending function is cancellable.
8-
* If the [Job] of the current coroutine is completed while this suspending function is suspended, this function
9-
* resumes with [CancellationException].
8+
* If the [Job] of the current coroutine is completed when this suspending function is invoked or while
9+
* this function is waiting for dispatching, it resumes with [CancellationException].
1010
*/
1111
suspend fun yield(): Unit = suspendCancellableCoroutine sc@ { cont ->
1212
(cont as SafeCancellableContinuation).resumeYield(Unit)

0 commit comments

Comments
 (0)