Skip to content

Commit a833181

Browse files
committed
Don't interrupt when cancelling future on completion
1 parent 3d9fb68 commit a833181

File tree

1 file changed

+5
-1
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental

1 file changed

+5
-1
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Job.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ private class CancelFutureOnCompletion(
296296
job: Job,
297297
val future: Future<*>
298298
) : JobNode(job) {
299-
override fun invoke(reason: Throwable?) { future.cancel(true) }
299+
override fun invoke(reason: Throwable?) {
300+
// Don't interrupt when cancelling future on completion, because no one is going to reset this
301+
// interruption flag and it will cause spurious failures elsewhere
302+
future.cancel(false)
303+
}
300304
override fun toString() = "CancelFutureOnCompletion[$future]"
301305
}
302306

0 commit comments

Comments
 (0)