Skip to content

Commit

Permalink
Rename TimeSource to SchedulerTimeSource due to KT-42625 (#2537)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Feb 16, 2021
1 parent 88b0966 commit 01dcfe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt
Expand Up @@ -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
Expand Down Expand Up @@ -108,10 +108,11 @@ internal class TaskImpl(
// Open for tests
internal class GlobalQueue : LockFreeTaskQueue<Task>(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()
}
4 changes: 2 additions & 2 deletions 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

Expand Down

0 comments on commit 01dcfe5

Please sign in to comment.