diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-14 22:20:57 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-14 22:29:15 +0200 |
| commit | 888a89efd3b639ce0ff48c35233ba95fed79bfc3 (patch) | |
| tree | 77d9c8d8b86c3f9f50abea90cee96ac65013d7ca /simulator/opendc-compute/opendc-compute-simulator | |
| parent | 79976e08aec24a8b773739036db05843aabb6a61 (diff) | |
simulator: Introduce SimProcessingUnit
This change introduces the SimProcessingUnit which represents a
simulated processing unit which the user can control during the workload
execution.
Diffstat (limited to 'simulator/opendc-compute/opendc-compute-simulator')
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt | 8 |
1 files changed, 2 insertions, 6 deletions
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() { |
