Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollback #2972, but leave a compatibility option with 1.6.0 #3131

Merged
merged 1 commit into from Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/jvm/src/DefaultExecutor.kt
Expand Up @@ -8,7 +8,7 @@ import kotlinx.coroutines.internal.*
import java.util.concurrent.*
import kotlin.coroutines.*

private val defaultMainDelayOptIn = systemProp("kotlinx.coroutines.main.delay", true)
private val defaultMainDelayOptIn = systemProp("kotlinx.coroutines.main.delay", false)

internal actual val DefaultDelay: Delay = initializeDefaultDelay()

Expand Down
13 changes: 6 additions & 7 deletions ui/kotlinx-coroutines-android/test/HandlerDispatcherTest.kt
Expand Up @@ -163,20 +163,19 @@ class HandlerDispatcherTest : TestBase() {
}

@Test
fun testDelayIsDelegatedToMain() = runTest {
fun testDelayIsNotDelegatedToMain() = runTest {
val mainLooper = shadowOf(Looper.getMainLooper())
mainLooper.pause()
val mainMessageQueue = shadowOf(Looper.getMainLooper().queue)
assertNull(mainMessageQueue.head)
val job = launch(Dispatchers.Default, start = CoroutineStart.UNDISPATCHED) {
expect(1)
delay(10_000_000)
expect(3)
delay(Long.MAX_VALUE)
expectUnreached()
}
expect(2)
assertNotNull(mainMessageQueue.head)
mainLooper.runOneTask()
job.join()
finish(4)
assertNull(mainMessageQueue.head)
job.cancelAndJoin()
finish(3)
}
}