We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e59c57 commit ffd9fd6Copy full SHA for ffd9fd6
kotlinx-coroutines-core/jvm/src/scheduling/WorkQueue.kt
@@ -122,16 +122,8 @@ internal class WorkQueue {
122
val end = producerIndex.value
123
124
while (start != end) {
125
- val index = start and MASK
126
- if (blockingTasksInBuffer.value == 0) break
127
- val value = buffer[index]
128
- if (value != null && value.isBlocking && buffer.compareAndSet(index, value, null)) {
129
- blockingTasksInBuffer.decrementAndGet()
130
- stolenTaskRef.element = value
131
- return TASK_STOLEN
132
- } else {
133
- ++start
134
- }
+ stolenTaskRef.element = tryExtractBlockingTask(start++) ?: continue
+ return TASK_STOLEN
135
}
136
return tryStealLastScheduled(stolenTaskRef, blockingOnly = true)
137
0 commit comments