diff --git a/kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt b/kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt index f273a510f6..da867c9853 100644 --- a/kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt +++ b/kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt @@ -52,7 +52,7 @@ internal val IDLE_WORKER_KEEP_ALIVE_NS = TimeUnit.SECONDS.toNanos( ) @JvmField -internal var schedulerTimeSource: TimeSource = NanoTimeSource +internal var schedulerTimeSource: SchedulerTimeSource = NanoTimeSource /** * Marker indicating that task is CPU-bound and will not block @@ -108,10 +108,11 @@ internal class TaskImpl( // Open for tests internal class GlobalQueue : LockFreeTaskQueue(singleConsumer = false) -internal abstract class TimeSource { +// Was previously TimeSource, renamed due to KT-42625 and KT-23727 +internal abstract class SchedulerTimeSource { abstract fun nanoTime(): Long } -internal object NanoTimeSource : TimeSource() { +internal object NanoTimeSource : SchedulerTimeSource() { override fun nanoTime() = System.nanoTime() } diff --git a/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt b/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt index a5c83d329a..233e442098 100644 --- a/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt +++ b/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt @@ -1,11 +1,11 @@ /* - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package kotlinx.coroutines.scheduling -internal class TestTimeSource(var time: Long) : TimeSource() { +internal class TestTimeSource(var time: Long) : SchedulerTimeSource() { override fun nanoTime() = time