From 2091bbcb68c3e94a958b7b3fd2b0a9bebc6fb627 Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Mon, 15 Feb 2021 21:28:06 +0300 Subject: [PATCH] Rename TimeSource to SchedulerTimeSource due to KT-42625 --- kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt | 7 ++++--- .../jvm/test/scheduling/TestTimeSource.kt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) 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