Skip to content

Commit b28426e

Browse files
authored
Unify the documentation of runBlocking (#4195)
The documentation of runBlocking was outdated for the native targets.
1 parent 33ec429 commit b28426e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kotlinx-coroutines-core/native/src/Builders.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import kotlin.coroutines.*
77
import kotlin.native.concurrent.*
88

99
/**
10-
* Runs new coroutine and **blocks** current thread _interruptibly_ until its completion.
10+
* Runs a new coroutine and **blocks** the current thread _interruptibly_ until its completion.
1111
*
1212
* It is designed to bridge regular blocking code to libraries that are written in suspending style, to be used in
1313
* `main` functions and in tests.
@@ -25,21 +25,21 @@ import kotlin.native.concurrent.*
2525
* Here, instead of releasing the thread on which `loadConfiguration` runs if `fetchConfigurationData` suspends, it will
2626
* block, potentially leading to thread starvation issues.
2727
*
28-
* The default [CoroutineDispatcher] for this builder in an implementation of [EventLoop] that processes continuations
28+
* The default [CoroutineDispatcher] for this builder is an internal implementation of event loop that processes continuations
2929
* in this blocked thread until the completion of this coroutine.
3030
* See [CoroutineDispatcher] for the other implementations that are provided by `kotlinx.coroutines`.
3131
*
3232
* When [CoroutineDispatcher] is explicitly specified in the [context], then the new coroutine runs in the context of
33-
* the specified dispatcher while the current thread is blocked. If the specified dispatcher implements [EventLoop]
34-
* interface and this `runBlocking` invocation is performed from inside of the this event loop's thread, then
35-
* this event loop is processed using its [processNextEvent][EventLoop.processNextEvent] method until coroutine completes.
33+
* the specified dispatcher while the current thread is blocked. If the specified dispatcher is an event loop of another `runBlocking`,
34+
* then this invocation uses the outer event loop.
3635
*
3736
* If this blocked thread is interrupted (see [Thread.interrupt]), then the coroutine job is cancelled and
3837
* this `runBlocking` invocation throws [InterruptedException].
3938
*
40-
* See [newCoroutineContext] for a description of debugging facilities that are available for newly created coroutine.
39+
* See [newCoroutineContext][CoroutineScope.newCoroutineContext] for a description of debugging facilities that are available
40+
* for a newly created coroutine.
4141
*
42-
* @param context context of the coroutine. The default value is an implementation of [EventLoop].
42+
* @param context the context of the coroutine. The default value is an event loop on the current thread.
4343
* @param block the coroutine code.
4444
*/
4545
public actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T {

0 commit comments

Comments
 (0)