Skip to content

Instantly share code, notes, and snippets.

@arthurp
Created February 17, 2017 18:57
Show Gist options
  • Save arthurp/56d7dd97b6c71182d23c1c34a905d2b5 to your computer and use it in GitHub Desktop.
Save arthurp/56d7dd97b6c71182d23c1c34a905d2b5 to your computer and use it in GitHub Desktop.
diff --git a/OrcScala/src/orc/run/core/VirtualClock.scala b/OrcScala/src/orc/run/core/VirtualClock.scala
index 9bcbf52..998de4f 100644
--- a/OrcScala/src/orc/run/core/VirtualClock.scala
+++ b/OrcScala/src/orc/run/core/VirtualClock.scala
@@ -80,9 +80,16 @@ class VirtualClock(ordering: (AnyRef, AnyRef) => Int, runtime: OrcRuntime)
dequeueMins() match {
case Some((newTime, first :: rest)) => {
currentTime = Some(newTime)
+ println(s"Advancing to $newTime waking $first :: $rest")
first.publish(true.asInstanceOf[AnyRef])
rest foreach { _.publish(false.asInstanceOf[AnyRef]) }
}
+ case Some((newTime, List())) => {
+ currentTime = Some(newTime)
+ println(s"Advancing to $newTime with nothing to wake")
+ // All Vawait calls where killed. We should be quiescent again soon and be rescheduled.
+ // We do update the time here since it was requested and allowed.
+ }
case None => {}
case x => throw new VirtualClockError("Virtual clock internal failure (dequeueMins return not matched): " + x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment