diff options
Diffstat (limited to 'simulator')
4 files changed, 11 insertions, 7 deletions
diff --git a/simulator/buildSrc/build.gradle.kts b/simulator/buildSrc/build.gradle.kts index 7ccd920f..6ad5cfe9 100644 --- a/simulator/buildSrc/build.gradle.kts +++ b/simulator/buildSrc/build.gradle.kts @@ -40,7 +40,7 @@ repositories { } dependencies { - implementation(kotlin("gradle-plugin", version = "1.4.10")) - implementation("org.jlleitschuh.gradle:ktlint-gradle:9.4.0") + implementation(kotlin("gradle-plugin", version = "1.4.21")) + implementation("org.jlleitschuh.gradle:ktlint-gradle:9.4.1") implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1") } diff --git a/simulator/buildSrc/src/main/kotlin/library.kt b/simulator/buildSrc/src/main/kotlin/library.kt index af278a07..6735c110 100644 --- a/simulator/buildSrc/src/main/kotlin/library.kt +++ b/simulator/buildSrc/src/main/kotlin/library.kt @@ -45,5 +45,5 @@ object Library { /** * Kotlin coroutines support */ - val KOTLINX_COROUTINES = "1.3.9" + val KOTLINX_COROUTINES = "1.4.2" } diff --git a/simulator/gradle/wrapper/gradle-wrapper.properties b/simulator/gradle/wrapper/gradle-wrapper.properties index be52383e..4d9ca164 100644 --- a/simulator/gradle/wrapper/gradle-wrapper.properties +++ b/simulator/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt index c6d5bdd1..4340708f 100644 --- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt +++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt @@ -95,6 +95,8 @@ public class SimBareMetalMachine( return object : SelectClause0 { @InternalCoroutinesApi override fun <R> registerSelectClause0(select: SelectInstance<R>, block: suspend () -> R) { + val context = select.completion.context + // Do not reset the usage state: we will set it ourselves usageFlush?.dispose() usageFlush = null @@ -139,7 +141,7 @@ public class SimBareMetalMachine( } // Schedule the flush after the entire slice has finished - currentDisposable = delay.invokeOnTimeout(duration, action) + currentDisposable = delay.invokeOnTimeout(duration, action, context) // Start the slice work currentWork = work @@ -158,11 +160,13 @@ public class SimBareMetalMachine( currentWork?.stop(duration) currentDisposable?.dispose() - // Schedule reset the usage of the machine since the call is returning - usageFlush = delay.invokeOnTimeout(1) { + val action = { usageState.value = 0.0 usageFlush = null } + + // Schedule reset the usage of the machine since the call is returning + usageFlush = delay.invokeOnTimeout(1, action, context) } select.disposeOnSelect(disposable) |
