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

Install Dispatchers.Default on native when creating new context for coroutine builders when there is no ContinuationInterceptor there #4075

Merged
merged 2 commits into from Mar 25, 2024

Conversation

whyoleg
Copy link
Contributor

@whyoleg whyoleg commented Mar 22, 2024

Fixes #4074

… coroutine builders when there is no `ContinuationInterceptor` there

Fixes #4074
@whyoleg whyoleg self-assigned this Mar 22, 2024
assertSame(Dispatchers.Default, newContextDispatcher(Dispatchers.Unconfined, Dispatchers.Default))
assertSame(Dispatchers.Unconfined, newContextDispatcher(Dispatchers.Default, Dispatchers.Unconfined))
assertSame(Dispatchers.Unconfined, newContextDispatcher(Dispatchers.Unconfined, Dispatchers.Unconfined))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to check the user-visible bug directly, like what you have in your reproducer:

    runTest {
        val job = Job()
        val scope = CoroutineScope(job + coroutineContext[CoroutineExceptionHandler]!!)
        scope.launch(Dispatchers.Default) {
            assertSame(Dispatchers.Default, coroutineContext[ContinuationInterceptor])
        }
        scope.launch {
            assertSame(Dispatchers.Default, coroutineContext[ContinuationInterceptor])
        }
        job.complete()
        job.join()
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, added additional test with launch

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thank you!

@dkhalanskyjb dkhalanskyjb merged commit d7c1edd into develop Mar 25, 2024
@dkhalanskyjb dkhalanskyjb deleted the fix-native-empty-dispatcher branch March 25, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants