summaryrefslogtreecommitdiff
path: root/opendc-core/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2017-10-24 17:00:44 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2017-10-24 18:31:44 +0200
commit8666a78b86a40c1d8dab28dd18e841318c01f97f (patch)
tree87a0c9895d62019c035cc169026e1e13354c24a0 /opendc-core/src/main
parentf16ad7f4cf4471edc4be46a6a3fb8799624fec73 (diff)
bug(#3): Add timeout for experiments
This change adds a timeout for experiments, which allows the user to set an upper bound on the duration of an experiment. Closes #3
Diffstat (limited to 'opendc-core/src/main')
-rw-r--r--opendc-core/src/main/kotlin/nl/atlarge/opendc/platform/Experiment.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/platform/Experiment.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/platform/Experiment.kt
index 225b2813..6aed5364 100644
--- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/platform/Experiment.kt
+++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/platform/Experiment.kt
@@ -25,6 +25,7 @@
package nl.atlarge.opendc.platform
import nl.atlarge.opendc.kernel.Kernel
+import nl.atlarge.opendc.kernel.time.Duration
/**
* A blueprint for a reproducible simulation in a pre-defined setting.
@@ -36,6 +37,16 @@ interface Experiment<out T> {
* Run the experiment on the specified simulation [Kernel].
*
* @param kernel The simulation kernel to run the experiment.
+ * @return The result of the experiment.
*/
fun run(kernel: Kernel): T
+
+ /**
+ * Run the experiment on the specified simulation [Kernel].
+ *
+ * @param kernel The simulation kernel to run the experiment.
+ * @param timeout The maximum duration of the experiment before returning to the caller.
+ * @return The result of the experiment or `null`.
+ */
+ fun run(kernel: Kernel, timeout: Duration): T?
}