summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-04-01 19:51:43 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-04-01 19:51:43 +0200
commit3fa3ad3af752b72ef792c2a4314e363f2586e59e (patch)
treea46d1039837163d35fb5f65e73e06fd6f8fd2858 /opendc/opendc-compute/src
parent896c6e2fa2cb84be2f383b39bf81c40101647694 (diff)
Launch in coroutine scope
Diffstat (limited to 'opendc/opendc-compute/src')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
index 00368c43..cc03d5f5 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
@@ -50,6 +50,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import java.util.UUID
@@ -96,7 +97,7 @@ class SimpleVirtDriver(
it.server.image.tags[IMAGE_PERF_INTERFERENCE_MODEL] as? PerformanceInterferenceModel?
performanceModel?.computeIntersectingItems(imagesRunning)
}
- }
+ }.launchIn(coroutineScope)
}
override suspend fun spawn(
@@ -233,7 +234,15 @@ class SimpleVirtDriver(
}
}
- eventFlow.emit(HypervisorEvent.SliceFinished(this@SimpleVirtDriver, totalBurst, totalBurst - totalRemainder, vms.size, server))
+ eventFlow.emit(
+ HypervisorEvent.SliceFinished(
+ this@SimpleVirtDriver,
+ totalBurst,
+ totalBurst - totalRemainder,
+ vms.size,
+ server
+ )
+ )
}
this.call = call
}