Skip to content

Commit 7e2d237

Browse files
authored
Fix the documentation for the Main dispatcher (#3879)
1 parent cedb066 commit 7e2d237

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ suspend fun main() = coroutineScope {
2626

2727
* [core](kotlinx-coroutines-core/README.md) — common coroutines across all platforms:
2828
* [launch] and [async] coroutine builders returning [Job] and [Deferred] light-weight futures with cancellation support;
29-
* [Dispatchers] object with [Main][Dispatchers.Main] dispatcher for Android/Swing/JavaFx, and [Default][Dispatchers.Default] dispatcher for background coroutines;
29+
* [Dispatchers] object with [Main][Dispatchers.Main] dispatcher for Android/Swing/JavaFx (which require the corresponding artifacts in runtime) and Darwin (included out of the box), and [Default][Dispatchers.Default] dispatcher for background coroutines;
3030
* [delay] and [yield] top-level suspending functions;
3131
* [Flow] — cold asynchronous stream with [flow][_flow] builder and comprehensive operator set ([filter], [map], etc);
3232
* [Channel], [Mutex], and [Semaphore] communication and synchronization primitives;
@@ -54,7 +54,7 @@ suspend fun main() = coroutineScope {
5454
* RxJava 2.x ([rxFlowable], [rxSingle], etc), and
5555
* RxJava 3.x ([rxFlowable], [rxSingle], etc), and
5656
* Project Reactor ([flux], [mono], etc).
57-
* [ui](ui/README.md) — modules that provide coroutine dispatchers for various single-threaded UI libraries:
57+
* [ui](ui/README.md) — modules that provide the [Main][Dispatchers.Main] dispatcher for various single-threaded UI libraries:
5858
* Android, JavaFX, and Swing.
5959
* [integration](integration/README.md) — modules that provide integration with various asynchronous callback- and future-based libraries:
6060
* Guava [ListenableFuture.await], and Google Play Services [Task.await];

kotlinx-coroutines-core/common/src/Dispatchers.common.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public expect object Dispatchers {
3131
* [`ServiceLoader`](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html).
3232
* - On JS it is equivalent to the [Default] dispatcher with [immediate][MainCoroutineDispatcher.immediate] support.
3333
* - On Native Darwin-based targets, it is a dispatcher backed by Darwin's main queue.
34-
* - On other Native targets, it is a single-threaded dispatcher backed by a standalone worker.
34+
* - On other Native targets, it is not available.
35+
* - `Dispatchers.setMain` from the `kotlinx-coroutines-test` artifact can replace the main dispatcher with a mock one for testing.
3536
*
36-
* In order to work with the `Main` dispatcher, the following artifact should be added to the project runtime dependencies:
37+
* In order to work with the `Main` dispatcher on the JVM, the following artifact should be added to the project runtime dependencies:
3738
* - `kotlinx-coroutines-android` — for Android Main thread dispatcher
3839
* - `kotlinx-coroutines-javafx` — for JavaFx Application thread dispatcher
3940
* - `kotlinx-coroutines-swing` — for Swing EDT dispatcher
40-
* - `kotlinx-coroutines-test` — for mocking the `Main` dispatcher in tests via `Dispatchers.setMain`
4141
*/
4242
public val Main: MainCoroutineDispatcher
4343

0 commit comments

Comments
 (0)