summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-05-20 12:53:29 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-05-20 12:54:14 +0200
commit5c3c7315da50d7bcd862fefe1b80f7a84f75f584 (patch)
tree1d9d3e99207c08359d9a88ae06c593de72ef821d /opendc/opendc-compute
parentd71c51a9850a0ce0146927d4f8b2bdd7996637e4 (diff)
docs: Clarify ugly hack for caching Delay
Diffstat (limited to 'opendc/opendc-compute')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
index a0ca2347..6a77415c 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
@@ -267,10 +267,13 @@ public class SimpleBareMetalDriver(
/**
* Cache the [Clock] for timing.
*/
- private val clock= domain.coroutineContext[SimulationContext]!!.clock
+ private val clock = domain.coroutineContext[SimulationContext]!!.clock
/**
- * Cache the [Delay] instance for timing. Ugly hack which may break in the future.
+ * Cache the [Delay] instance for timing.
+ *
+ * XXX We need to cache this before the call to [onRun] since doing this in [onRun] is too heavy.
+ * XXX Note however that this is an ugly hack which may break in the future.
*/
@OptIn(InternalCoroutinesApi::class)
private val delay = domain.coroutineContext[ContinuationInterceptor] as Delay
@@ -290,8 +293,6 @@ public class SimpleBareMetalDriver(
usageFlush?.dispose()
usageFlush = null
- val context = select.completion.context
-
val queue = batch.iterator()
var start = Long.MIN_VALUE
var currentWork: SliceWork? = null