summaryrefslogtreecommitdiff
path: root/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2018-02-15 16:18:55 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2018-02-15 16:18:55 +0100
commit99dc5592bbca0f7d3a9d411268608c112b135896 (patch)
treee92cf0012b6dfab09951f69f1f672ae589d02a04 /opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt
parent157d30beb52c75831e29a1a22c199b95d6d30b42 (diff)
refactor(#18): Handle process launch using a kernel process
This change will make the kernel handle the launch of processes using a kernel process that is launched at the start of the simulation and launches processes when it receives `Launch` messages.
Diffstat (limited to 'opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt')
-rw-r--r--opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt30
1 files changed, 30 insertions, 0 deletions
diff --git a/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt b/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt
new file mode 100644
index 00000000..73c3676f
--- /dev/null
+++ b/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt
@@ -0,0 +1,30 @@
+package com.atlarge.opendc.omega
+
+import com.atlarge.opendc.simulator.Context
+import com.atlarge.opendc.simulator.Process
+
+/**
+ * An internal message used by the Omega simulation kernel to indicate to a suspended [Process], that it should wake up
+ * and resume execution.
+ *
+ * This message is not guaranteed to work on other simulation kernels and [Context.interrupt] should be preferred to
+ * wake up a process from another entity.
+ *
+ * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl)
+ */
+object Resume
+
+/**
+ * An internal message used by the Omega simulation kernel to indicate to a suspended [Process], that a timeout has been
+ * reached and that it should wake up and resume execution.
+ *
+ * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl)
+ */
+object Timeout
+
+/**
+ * An internal message used by the Omega simulation kernel to launch a process.
+ *
+ * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl)
+ */
+data class Launch<in M>(val process: Process<*, M>)