File tree 5 files changed +16
-8
lines changed
5 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ public final class kotlinx/coroutines/Dispatchers {
277
277
public static final fun getIO ()Lkotlinx/coroutines/CoroutineDispatcher;
278
278
public static final fun getMain ()Lkotlinx/coroutines/MainCoroutineDispatcher;
279
279
public static final fun getUnconfined ()Lkotlinx/coroutines/CoroutineDispatcher;
280
- public final fun shutdown (Lkotlinx/coroutines/CoroutineDispatcher ;)V
280
+ public final fun shutdownDefaultDispatcher (Lkotlinx/coroutines/Dispatchers ;)V
281
281
}
282
282
283
283
public final class kotlinx/coroutines/DispatchersKt {
Original file line number Diff line number Diff line change @@ -80,12 +80,20 @@ public expect object Dispatchers {
80
80
public val Unconfined : CoroutineDispatcher
81
81
82
82
/* *
83
- * Shuts down the dispatcher.
83
+ * Shuts down the [Default] dispatcher.
84
84
*
85
85
* Its implementation depends on the platform:
86
86
* - On Kotlin/JVM and Kotlin/JS takes no effect.
87
- * - On Kotlin/Native requests termination of the worker created by the [Default] dispatcher.
87
+ * - On Kotlin/Native requests termination of the Worker created by the [Default] dispatcher.
88
+ * [Default] dispatcher is backed by a [SingleThreadDispatcher] that creates a Worker and never shuts it down.
89
+ * According to the current implementation, Kotlin/Native memory leak checker can not do it’s job while
90
+ * there are active workers left at the program shutdown. Thus, if the memory leak checker is activated
91
+ * (`Platform.isMemoryLeakCheckerActive = true`) this method should be called before program termination
92
+ * to avoid the leaking worker.
93
+ *
94
+ * **Note**: For now this declaration is only present in `native-mt` versions of `kotlinx.coroutines`.
95
+ * It will be available in regular versions when #2558 is implemeted.
88
96
*/
89
97
@ExperimentalCoroutinesApi
90
- public fun CoroutineDispatcher. shutdown ()
98
+ public fun Dispatchers. shutdownDefaultDispatcher ()
91
99
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public actual object Dispatchers {
10
10
public actual val Default : CoroutineDispatcher = createDefaultDispatcher()
11
11
public actual val Main : MainCoroutineDispatcher = JsMainDispatcher (Default , false )
12
12
public actual val Unconfined : CoroutineDispatcher = kotlinx.coroutines.Unconfined
13
- public actual fun CoroutineDispatcher. shutdown () {}
13
+ public actual fun Dispatchers. shutdownDefaultDispatcher () {}
14
14
}
15
15
16
16
private class JsMainDispatcher (
Original file line number Diff line number Diff line change @@ -116,5 +116,5 @@ public actual object Dispatchers {
116
116
@JvmStatic
117
117
public val IO : CoroutineDispatcher = DefaultScheduler .IO
118
118
119
- public actual fun CoroutineDispatcher. shutdown () {}
119
+ public actual fun Dispatchers. shutdownDefaultDispatcher () {}
120
120
}
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ public actual object Dispatchers {
13
13
public actual val Main : MainCoroutineDispatcher = createMainDispatcher(Default )
14
14
public actual val Unconfined : CoroutineDispatcher get() = kotlinx.coroutines.Unconfined // Avoid freezing
15
15
16
- public actual fun CoroutineDispatcher. shutdown () {
17
- if ( this == = DefaultDispatcher ) shutdown()
16
+ public actual fun Dispatchers. shutdownDefaultDispatcher () {
17
+ DefaultDispatcher . shutdown()
18
18
}
19
19
}
20
20
You can’t perform that action at this time.
0 commit comments