File tree 7 files changed +49
-5
lines changed
7 files changed +49
-5
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ See [Contributing Guidelines](CONTRIBUTING.md).
212
212
[ MainScope() ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-main-scope.html
213
213
[ SupervisorJob() ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-supervisor-job.html
214
214
[ CoroutineExceptionHandler ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-exception-handler/index.html
215
- [ Dispatchers.IO ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/- i-o.html
215
+ [ Dispatchers.IO ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-i-o.html
216
216
[ asCoroutineDispatcher ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
217
217
[ Promise.await ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/await.html
218
218
[ promise ] : https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/promise.html
Original file line number Diff line number Diff line change @@ -302,6 +302,7 @@ public final class kotlinx/coroutines/Dispatchers {
302
302
303
303
public final class kotlinx/coroutines/DispatchersKt {
304
304
public static final field IO_PARALLELISM_PROPERTY_NAME Ljava/lang/String;
305
+ public static final synthetic fun getIO (Lkotlinx/coroutines/Dispatchers;)Lkotlinx/coroutines/CoroutineDispatcher;
305
306
}
306
307
307
308
public abstract interface class kotlinx/coroutines/DisposableHandle {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import kotlin.coroutines.*
12
12
public expect object Dispatchers {
13
13
/* *
14
14
* The default [CoroutineDispatcher] that is used by all standard builders like
15
- * [launch][CoroutineScope.launch], [async][CoroutineScope.async], etc
15
+ * [launch][CoroutineScope.launch], [async][CoroutineScope.async], etc.
16
16
* if neither a dispatcher nor any other [ContinuationInterceptor] is specified in their context.
17
17
*
18
18
* It is backed by a shared pool of threads on JVM. By default, the maximum number of threads used
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+ package kotlinx.coroutines
6
+
7
+ /* *
8
+ * The [CoroutineDispatcher] that is designed for offloading blocking IO tasks to a shared pool of threads.
9
+ * Additional threads in this pool are created on demand.
10
+ *
11
+ * By default, the pool is backed by `64` standalone threads, for the additional details
12
+ * such as elasticity, dynamic sizing and interaction with [CoroutineDispatcher.limitedParallelism],
13
+ * please refer to the documentation of `Dispatchers.IO` on specific platform.
14
+ */
15
+ @Suppress(" EXTENSION_SHADOWED_BY_MEMBER" )
16
+ public expect val Dispatchers .IO : CoroutineDispatcher
17
+
18
+
Original file line number Diff line number Diff line change @@ -6,3 +6,7 @@ package kotlinx.coroutines
6
6
class DefaultDispatcherConcurrencyTest : AbstractDispatcherConcurrencyTest () {
7
7
override val dispatcher: CoroutineDispatcher = Dispatchers .Default
8
8
}
9
+
10
+ class IoDispatcherConcurrencyTest : AbstractDispatcherConcurrencyTest () {
11
+ override val dispatcher: CoroutineDispatcher = Dispatchers .IO
12
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2
+ * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
3
*/
4
4
5
- @file:Suppress(" unused" )
6
-
7
5
package kotlinx.coroutines
8
6
9
7
import kotlinx.coroutines.internal.*
@@ -161,3 +159,13 @@ public actual object Dispatchers {
161
159
DefaultScheduler .shutdown()
162
160
}
163
161
}
162
+
163
+ /* *
164
+ * `actual` counterpart of the corresponding `expect` declaration.
165
+ * Should never be used directly from JVM sources, all accesses
166
+ * to `Dispatchers.IO` should be resolved to the corresponding member of [Dispatchers] object.
167
+ * @suppress
168
+ */
169
+ @Suppress(" EXTENSION_SHADOWED_BY_MEMBER" )
170
+ @Deprecated(message = " Should not be used directly" , level = DeprecationLevel .HIDDEN )
171
+ public actual val Dispatchers .IO : CoroutineDispatcher get() = Dispatchers .IO
Original file line number Diff line number Diff line change @@ -19,6 +19,19 @@ public actual object Dispatchers {
19
19
internal fun injectMain (dispatcher : MainCoroutineDispatcher ) {
20
20
injectedMainDispatcher = dispatcher
21
21
}
22
+
23
+ internal val IO : CoroutineDispatcher = newFixedThreadPoolContext(64 , " Dispatchers.IO" )
22
24
}
23
25
26
+ /* *
27
+ * The [CoroutineDispatcher] that is designed for offloading blocking IO tasks to a shared pool of threads.
28
+ * Additional threads in this pool are created on demand.
29
+ *
30
+ * On Native platforms it is backed by a standalone [newFixedThreadPoolContext] with `64` worker threads in it.
31
+ * **NB**: this dispatcher **does not** share the same elasticity behaviour for [CoroutineDispatcher.limitedParallelism]
32
+ * as `Dispatchers.IO` on JVM.
33
+ */
34
+ @Suppress(" EXTENSION_SHADOWED_BY_MEMBER" )
35
+ public actual val Dispatchers .IO : CoroutineDispatcher get() = IO
36
+
24
37
internal expect fun createMainDispatcher (default : CoroutineDispatcher ): MainCoroutineDispatcher
You can’t perform that action at this time.
0 commit comments