Skip to content

Commit ffd9fd6

Browse files
committed
~
1 parent 3e59c57 commit ffd9fd6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

kotlinx-coroutines-core/jvm/src/scheduling/WorkQueue.kt

+2-10
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,8 @@ internal class WorkQueue {
122122
val end = producerIndex.value
123123

124124
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-
}
125+
stolenTaskRef.element = tryExtractBlockingTask(start++) ?: continue
126+
return TASK_STOLEN
135127
}
136128
return tryStealLastScheduled(stolenTaskRef, blockingOnly = true)
137129
}

0 commit comments

Comments
 (0)