Closed
Description
Just run the following example and look at the result
fun main(args: Array<String>) {
val waiters = 1000
val mutex = Mutex()
val start = CountDownLatch(1)
val done = CountDownLatch(waiters)
launch(CommonPool) {
mutex.lock()
try {
start.await()
} finally {
mutex.unlock() // StackOverflowError
}
}
repeat(waiters) {
launch(Unconfined) {
mutex.withLock {
done.countDown()
}
}
}
start.countDown()
println(done.await(1, SECONDS))
}
Could you avoid using call stack when iterating lock waiters?
Metadata
Metadata
Assignees
Labels
No labels