@@ -385,8 +385,7 @@ internal class CoroutineScheduler(
385
385
*
386
386
* [taskContext] -- concurrency context of given [block].
387
387
* [fair] -- whether this [dispatch] call is fair.
388
- * If `true` then the task will be dispatched in a FIFO manner and no additional workers will be requested,
389
- * but only if the current thread is a corresponding worker thread.
388
+ * If `true` then the task will be dispatched in a FIFO manner.
390
389
* Note that caller cannot be ensured that it is being executed on worker thread for the following reasons:
391
390
* - [CoroutineStart.UNDISPATCHED]
392
391
* - Concurrent [close] that effectively shutdowns the worker thread.
@@ -408,13 +407,11 @@ internal class CoroutineScheduler(
408
407
throw RejectedExecutionException (" $schedulerName was terminated" )
409
408
}
410
409
}
411
- val skipUnpark = fair && currentWorker != null
412
410
// Checking 'task' instead of 'notAdded' is completely okay
413
411
if (isBlockingTask) {
414
412
// Use state snapshot to better estimate the number of running threads
415
- signalBlockingWork(stateSnapshot, skipUnpark = skipUnpark )
413
+ signalBlockingWork(stateSnapshot)
416
414
} else {
417
- if (skipUnpark) return
418
415
signalCpuWork()
419
416
}
420
417
}
@@ -430,8 +427,7 @@ internal class CoroutineScheduler(
430
427
}
431
428
432
429
// NB: should only be called from 'dispatch' method due to blocking tasks increment
433
- private fun signalBlockingWork (stateSnapshot : Long , skipUnpark : Boolean ) {
434
- if (skipUnpark) return
430
+ private fun signalBlockingWork (stateSnapshot : Long ) {
435
431
if (tryUnpark()) return
436
432
// Use state snapshot to avoid accidental thread overprovision
437
433
if (tryCreateWorker(stateSnapshot)) return
0 commit comments