-
Notifications
You must be signed in to change notification settings - Fork 1.9k
EventLoop integration and reuse for runBlocking and Unconfined dispatchers #889
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11a90d7
to
b91442a
Compare
…chers - Event loop that is created by runBlocking or by Unconfined dispatcher is reused across the same thread to prevent blocking of the loop - Semantics of runBlocking and Unconfined are fully retained - DefaultExecutor also registers itself as running event loop and thus cannot be blocked by runBlocking - Consolidates thread-local handling for native - Also fixes thread-local memory leak on JVM (does not use custom class) Fixes #860
b91442a
to
5a3dd35
Compare
It is a name people are used to seen then they example the coroutineContext inside runBlocking. The fact that it is also used for unconfined now is Ok as it is not directly exposed.
31aff8f
to
ffe8fac
Compare
To be used by kotlinx-io
ffe8fac
to
2c1ae01
Compare
qwwdfsad
requested changes
Dec 18, 2018
4b936b5
to
0e7f98c
Compare
* Unused ArrayQueue is dropped * executeUnconfined and resumeUnconfined are defined as extension funs * EventLoop.increment renamed to delta * Test for EventLoop added Note: This PR also fixes #850
0e7f98c
to
5038f92
Compare
…oop) Previous logic of handling runBlocking(context) had a flaw in that the presence of EventLoop-capable dispatcher in the context lead to the blocking of current thread's event loop. Test for this issue is added.
Must be invoked from the correct thread.
So that runBlocking processes events from TestCoroutineContext
* Unconfined tasks take priority over others * Tracking of unconfined tasks simplified * Removed duplication between ArrayQueue/Queue classes in JS
qwwdfsad
requested changes
Dec 21, 2018
qwwdfsad
requested changes
Dec 21, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
is reused across the same thread to prevent blocking of the loop
cannot be blocked by runBlocking
Fixes #860