Skip to content

Commit 8c07124

Browse files
mareklangiewiczqwwdfsad
authored andcommitted
Replace old UI dispatcher name with Dispatchers.Main
1 parent 22c7809 commit 8c07124

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public object GlobalScope : CoroutineScope {
163163
* ... load some UI data ...
164164
* }
165165
*
166-
* withContext(UI) {
166+
* withContext(Dispatchers.Main) {
167167
* doSomeWork()
168168
* val result = data.await()
169169
* display(result)

common/kotlinx-coroutines-core-common/src/channels/Channel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public interface SendChannel<in E> {
111111
* events.offer(event)
112112
* }
113113
*
114-
* val uiUpdater = launch(UI, parent = UILifecycle) {
114+
* val uiUpdater = launch(Dispatchers.Main, parent = UILifecycle) {
115115
* events.consume {}
116116
* events.cancel()
117117
* }

core/kotlinx-coroutines-core/src/ThreadContextElement.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import kotlin.coroutines.*
4040
* }
4141
*
4242
* // Usage
43-
* launch(UI + CoroutineName("Progress bar coroutine")) { ... }
43+
* launch(Dispatchers.Main + CoroutineName("Progress bar coroutine")) { ... }
4444
* ```
4545
*
4646
* Every time this coroutine is resumed on a thread, UI thread name is updated to
@@ -90,7 +90,7 @@ public interface ThreadContextElement<S> : CoroutineContext.Element {
9090
* println(myThreadLocal.get()) // Prints "null"
9191
* launch(Dispatchers.Default + myThreadLocal.asContextElement(value = "foo")) {
9292
* println(myThreadLocal.get()) // Prints "foo"
93-
* withContext(UI) {
93+
* withContext(Dispatchers.Main) {
9494
* println(myThreadLocal.get()) // Prints "foo", but it's on UI thread
9595
* }
9696
* }
@@ -101,7 +101,7 @@ public interface ThreadContextElement<S> : CoroutineContext.Element {
101101
*
102102
* ```
103103
* myThreadLocal.set("main")
104-
* withContext(UI) {
104+
* withContext(Dispatchers.Main) {
105105
* println(myThreadLocal.get()) // Prints "main"
106106
* myThreadLocal.set("UI")
107107
* }

0 commit comments

Comments
 (0)