@@ -251,7 +251,7 @@ internal class CoroutineScheduler(
251
251
companion object {
252
252
private const val MAX_SPINS = 1000
253
253
private const val MAX_YIELDS = MAX_SPINS + 500
254
-
254
+
255
255
@JvmStatic // Note, that is fits into Int (it is equal to 10^9)
256
256
private val MAX_PARK_TIME_NS = TimeUnit .SECONDS .toNanos(1 ).toInt()
257
257
@@ -374,7 +374,7 @@ internal class CoroutineScheduler(
374
374
// If we've created the first cpu worker and corePoolSize > 1 then create
375
375
// one more (second) cpu worker, so that stealing between them is operational
376
376
if (newCpuWorkers == 1 && corePoolSize > 1 ) createNewWorker()
377
- if (newCpuWorkers > 0 ) return
377
+ if (newCpuWorkers > 0 ) return
378
378
}
379
379
// Try unpark again in case there was race between permit release and parking
380
380
tryUnpark()
@@ -621,7 +621,7 @@ internal class CoroutineScheduler(
621
621
* This attempt may fail either because worker terminated itself or because someone else
622
622
* claimed this worker (though this case is rare, because require very bad timings)
623
623
*/
624
- fun tryForbidTermination (): Boolean {
624
+ fun tryForbidTermination (): Boolean {
625
625
val state = terminationState.value
626
626
return when (state) {
627
627
TERMINATED -> false // already terminated
@@ -672,7 +672,7 @@ internal class CoroutineScheduler(
672
672
673
673
// Note: it is concurrently reset by idleResetBeforeUnpark
674
674
private var parkTimeNs = MIN_PARK_TIME_NS
675
-
675
+
676
676
private var rngState = random.nextInt()
677
677
private var lastStealIndex = 0 // try in order repeated, reset when unparked
678
678
@@ -699,7 +699,7 @@ internal class CoroutineScheduler(
699
699
afterTask(task)
700
700
}
701
701
}
702
- } catch (e: ShutdownException ) {
702
+ } catch (e: ShutdownException ) {
703
703
// race with shutdown -- ignore exception and don't print it on the console
704
704
} finally {
705
705
tryReleaseCpu(WorkerState .TERMINATED )
0 commit comments