Skip to content

Properly detect non-released reusable continuations in non-reusable o… #2772

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
merged 2 commits into from
Jun 23, 2021

Conversation

qwwdfsad
Copy link
Member

…nes and await for reusability to have a consistent state

Fixes #2736
Fixes #2768

…nes and await for reusability to have a consistent state

Fixes #2736
Fixes #2768
@qwwdfsad qwwdfsad requested a review from dkhalanskyjb June 18, 2021 15:33
@dkhalanskyjb
Copy link
Collaborator

Doesn't look like I can add comments to lines that aren't part of the change, so writing it here:

    * Ensure that the caller to DispatchedContinuation.isReusable is reusable itself
    * Using previous invariant, simplify DispatchedContinuation.isReusable to a single null-check
    * It also restores the invariant that `cc.isReusable() == cc.resumeMode.isReusableMode`
@qwwdfsad
Copy link
Member Author

While answering your comments, I've found a more simple, robust and approachable way to do the same thing.
PTAL and see if that is better and if it answers your questions implicitly

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.

Yep, much clearer this way.

@qwwdfsad qwwdfsad merged commit d2c652e into develop Jun 23, 2021
@qwwdfsad qwwdfsad deleted the fix-reusability-race branch June 23, 2021 11:02
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this pull request Sep 14, 2022
Kotlin#2772)

* Properly detect non-released reusable continuations in non-reusable ones and await for reusability to have a consistent state
* Ensure that the caller to DispatchedContinuation.isReusable is reusable itself
* Using the previous invariant, simplify DispatchedContinuation.isReusable to a single null-check
* It also restores the invariant that `cc.isReusable() == cc.resumeMode.isReusableMode`

Fixes Kotlin#2736
Fixes Kotlin#2768
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.

2 participants