Fix bug when blocking due to no free registers.
[gem5.git] / src / sim / sim_events.cc
index d9e8bdeaac8f45f07badb63ee89387a5dc84a188..a4457a11ca04d18a0de0f3fb470aaab8be40c0aa 100644 (file)
@@ -57,6 +57,11 @@ SimLoopExitEvent::process()
 
     // otherwise do nothing... the IsExitEvent flag takes care of
     // exiting the simulation loop and returning this object to Python
+
+    // but if you are doing this on intervals, don't forget to make another
+    if (repeat) {
+        schedule(curTick + repeat);
+    }
 }
 
 
@@ -66,16 +71,20 @@ SimLoopExitEvent::description()
     return "simulation loop exit";
 }
 
-void
-exitSimLoop(Tick when, const std::string &message, int exit_code)
+SimLoopExitEvent *
+schedExitSimLoop(const std::string &message, Tick when, Tick repeat,
+                 EventQueue *q, int exit_code)
 {
-    new SimLoopExitEvent(when, message, exit_code);
+    if (q == NULL)
+        q = &mainEventQueue;
+
+    return new SimLoopExitEvent(q, when, repeat, message, exit_code);
 }
 
 void
 exitSimLoop(const std::string &message, int exit_code)
 {
-    exitSimLoop(curTick, message, exit_code);
+    schedExitSimLoop(message, curTick, 0, NULL, exit_code);
 }
 
 void
@@ -149,21 +158,3 @@ CheckSwapEvent::description()
 {
     return "check swap";
 }
-
-//
-// handle progress event: print message and reschedule
-//
-void
-ProgressEvent::process()
-{
-    DPRINTFN("ProgressEvent\n");
-    // reschedule for next interval
-    schedule(curTick + interval);
-}
-
-
-const char *
-ProgressEvent::description()
-{
-    return "progress message";
-}