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

Simplify internal machinery #2512

Merged
merged 4 commits into from Mar 23, 2021
Merged

Simplify internal machinery #2512

merged 4 commits into from Mar 23, 2021

Conversation

qwwdfsad
Copy link
Member

@qwwdfsad qwwdfsad commented Feb 1, 2021

No description provided.

@qwwdfsad qwwdfsad marked this pull request as ready for review February 1, 2021 16:59
@qwwdfsad qwwdfsad changed the title Simplify abstract coroutine Simplify internal machinery Feb 1, 2021
    * Always establish parent-child relationship when creating a subclass of AbstractCoroutine. That's our own internal class that we have full control of and it never has a chance to leak to the user-code (so cancellation handlers will be installed etc.)
    * As a consequence, get rid of parentContext in all our coroutine classes that are not ScopeCoroutine
    * Remove some dead code

The whole late-binding of initParentJob seems the be the legacy of days when AbstractCoroutine was public and CancellableContinuation implemented a Job
    * Leverage already presented information in our implementation, just expose it via already present internal interface
@qwwdfsad qwwdfsad force-pushed the simplify-abstract-coroutine branch from 5ddde09 to 45e0652 Compare March 22, 2021 13:20
…arent-child relationship should be established

    * Test all coroutine builders
    * Fix FlowSubscription
@qwwdfsad qwwdfsad force-pushed the simplify-abstract-coroutine branch from aba7d32 to 523638f Compare March 22, 2021 15:02
@qwwdfsad
Copy link
Member Author

Instead of copy-pasting it as discussed, I've stick with a slightly better approach where the constructor demands to choose one or the other option

@qwwdfsad qwwdfsad requested a review from elizarov March 22, 2021 15:13
Copy link
Contributor

@elizarov elizarov left a comment

Choose a reason for hiding this comment

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

Ok

@qwwdfsad qwwdfsad merged commit 05f7d5d into develop Mar 23, 2021
@qwwdfsad qwwdfsad deleted the simplify-abstract-coroutine branch March 23, 2021 09:22
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this pull request Sep 14, 2022
* Merge onStartInternal and onStart to reduce the number of methods and make code a bit simpler
* Rework initParentJob
* Always establish a parent-child relationship when creating a subclass of AbstractCoroutine. That's our own internal class that we have full control of and it never has a chance to leak to the user-code (so cancellation handlers will be installed etc.).  Force implementors of AbstractCoroutine deliberately choose whether parent-child relationship should be established
 * As a consequence, get rid of parentContext in all our coroutine classes that are not ScopeCoroutine
* Remove some dead code
* Get rid of an additional parent field from ScopeCoroutine
 Leverage already presented information in our implementation, just expose it via an already present internal interface
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