From 888a89efd3b639ce0ff48c35233ba95fed79bfc3 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 14 Apr 2021 22:20:57 +0200 Subject: simulator: Introduce SimProcessingUnit This change introduces the SimProcessingUnit which represents a simulated processing unit which the user can control during the workload execution. --- .../src/main/kotlin/org/opendc/compute/simulator/SimHost.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'simulator/opendc-compute') diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt index ea775efc..6d87e444 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt @@ -296,7 +296,6 @@ public class SimHost( override fun close() { scope.cancel() machine.close() - _state = HostState.DOWN } override fun toString(): String = "SimHost[uid=$uid,name=$name,model=$model]" @@ -389,7 +388,7 @@ public class SimHost( assert(job == null) { "Concurrent job running" } val workload = mapper.createWorkload(server) - val job = scope.launch { + job = scope.launch { delay(1) // TODO Introduce boot time init() cont.resume(Unit) @@ -400,12 +399,9 @@ public class SimHost( exit(cause) } finally { machine.close() + job = null } } - this.job = job - job.invokeOnCompletion { - this.job = null - } } private fun init() { -- cgit v1.2.3