Skip to content

Commit bb4885c

Browse files
committed
~get rid of volatile, tune toString
1 parent 47ef67f commit bb4885c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ internal class CoroutineScheduler(
508508
* E.g. for [1b, 1b, 2c, 1d] means that pool has
509509
* two blocking workers with queue size 1, one worker with CPU permit and queue size 1
510510
* and one dormant (executing his local queue before parking) worker with queue size 1.
511-
* TODO revisit
512511
*/
513512
override fun toString(): String {
514513
var parkedWorkers = 0
@@ -551,10 +550,10 @@ internal class CoroutineScheduler(
551550
"running workers queues = $queueSizes, "+
552551
"global CPU queue size = ${globalCpuQueue.size}, " +
553552
"global blocking queue size = ${globalBlockingQueue.size}, " +
554-
"Control State Workers {" +
555-
"created = ${createdWorkers(state)}, " +
556-
"blocking = ${blockingTasks(state)}, " +
557-
"CPU acquired = ${corePoolSize - availableCpuPermits(state)}" +
553+
"Control State {" +
554+
"created workers= ${createdWorkers(state)}, " +
555+
"blocking tasks = ${blockingTasks(state)}, " +
556+
"CPUs acquired = ${corePoolSize - availableCpuPermits(state)}" +
558557
"}]"
559558
}
560559

@@ -595,7 +594,7 @@ internal class CoroutineScheduler(
595594
* Worker state. **Updated only by this worker thread**.
596595
* By default, worker is in DORMANT state in the case when it was created, but all CPU tokens or tasks were taken.
597596
*/
598-
@Volatile
597+
@JvmField
599598
var state = WorkerState.DORMANT
600599
val isBlocking: Boolean get() = state == WorkerState.BLOCKING
601600

0 commit comments

Comments
 (0)