-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement optional thread interrupt on coroutine cancellation (#57) #1922
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
Conversation
) See issue Kotlin#57 for details Signed-off-by: Trol <[email protected]>
private fun initThread() { | ||
val thread = Thread.currentThread() | ||
state.loop { s -> | ||
when { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps when (s) {
?
override fun invoke(cause: Throwable?) { | ||
state.loop { s -> | ||
when { | ||
s === Init || (s is Working && s.thread === null) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you swap initThread and initInvokeOnCancel then s.thread === null
can't happen, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a great idea, I will check it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Unfortunately, we are not ready to accept this PR. Changes are intrusive, with a lot of failure modes and corner cases, while the problem it is trying to solve is pretty marginal (especially when you know that a vast majority of Java code doesn't handle interruptions properly). We decided it's not worth to maintain it in a long term, sorry.
…ellation (Kotlin#57) This is implementation of issue Kotlin#57 and non-intrusive variant of Kotlin#1922 Signed-off-by: Trol <[email protected]>
Superseded by #1934 |
See issue #57 for details
Signed-off-by: Trol [email protected]