Skip to content

Commit

Permalink
Better NonCancellable docs (Kotlin#2633)
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov authored and pablobaxter committed Sep 14, 2022
1 parent bbb5415 commit 954503e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kotlinx-coroutines-core/common/src/NonCancellable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import kotlin.coroutines.*
* // this code will not be cancelled
* }
* ```
*
* **WARNING**: This object is not designed to be used with [launch], [async], and other coroutine builders.
* if you write `launch(NonCancellable) { ... }` then not only the newly launched job will not be cancelled
* when the parent is cancelled, the whole parent-child relation between parent and child is severed.
* The parent will not wait for the child's completion, nor will be cancelled when the child crashed.
*/
public object NonCancellable : AbstractCoroutineContextElement(Job), Job {
/**
Expand Down

0 comments on commit 954503e

Please sign in to comment.