diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-25 14:53:54 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-25 14:53:54 +0200 |
| commit | aa9b32f8cd1467e9718959f400f6777e5d71737d (patch) | |
| tree | b88bbede15108c6855d7f94ded4c7054df186a72 /opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt | |
| parent | eb0e0a3bc557c05a70eead388797ab850ea87366 (diff) | |
| parent | b7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (diff) | |
merge: Integrate v2.1 progress into public repository
This pull request integrates the changes planned for the v2.1 release of
OpenDC into the public Github repository in order to sync the progress
of both repositories.
Diffstat (limited to 'opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt')
| -rw-r--r-- | opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt b/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt index aa2f3367..d7da7f99 100644 --- a/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt +++ b/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt @@ -24,7 +24,6 @@ package org.opendc.utils import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.selects.select import java.time.Clock import java.util.* @@ -145,9 +144,9 @@ public class TimerScheduler<T>(context: CoroutineContext, private val clock: Clo queue.poll() if (queue.isNotEmpty()) { - channel.sendBlocking(peek.timestamp) + channel.trySend(peek.timestamp) } else { - channel.sendBlocking(null) + channel.trySend(null) } } } @@ -212,7 +211,7 @@ public class TimerScheduler<T>(context: CoroutineContext, private val clock: Clo // Check if we need to push the interruption forward // Note that we check by timer reference if (queue.peek() === timer) { - channel.offer(timer.timestamp) + channel.trySend(timer.timestamp) } timer |
