Dispatchers.Default
is not installed in coroutine builders when there is no ContinuationInterceptor
in native
#4074
Labels
Describe the bug
When using one of the coroutine builders (like
launch
) if there is noContinuationInterceptor
/CoroutineDispatcher
incoroutineContext
coroutine should start onDispatchers.Default
as specified in documentation of: Dispatchers.Default, CoroutineScope.newCoroutineContext (which is used under the hood of coroutine builders) and in CoroutineScope.launch itself.This contract is implemented in
actual
implementations ofCoroutineScope.newCoroutineContext
for all platforms (jvm, js, wasmJs) except native, where single-threaded DefaultExecutor is used instead.Provide a Reproducer
In following example on jvm, js, wasmJs the same dispatcher will be printed (it's name depends on target, but it is Dispatchers.Default`), but on native dispatchers are different:
At my side when running test on
macosArm64
:Expected behaviour
Dispatchers.Default
should be installed on native.I found this issue during running some tests, after refactoring tests execution time was increased. I had no idea why, but then when I checked dispatcher in some test and found that it's different - just because before it was just
EmptyCoroutineContext
but now it's Dispatchers.Default`.Note: test execution time become like several times slower when using
Dispatchers.Default
- not sure if it's expected or not...The text was updated successfully, but these errors were encountered: