Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TimeSource to SchedulerTimeSource due to KT-42625 #2537

Merged
merged 1 commit into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions kotlinx-coroutines-core/jvm/src/scheduling/Tasks.kt
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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