Make Simulator::IsFinished () take into account the stop time. Needed to run custom simulation loops (see bug 375)
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Tue, 13 Jan 2009 19:27:44 +0000
changeset 4085 31945ecb17e2
parent 4083 5a5d8b94047a
child 4086 37dbf76b4c66
Make Simulator::IsFinished () take into account the stop time. Needed to run custom simulation loops (see bug 375)
src/simulator/default-simulator-impl.cc
src/simulator/realtime-simulator-impl.cc
src/simulator/simulator.h
--- a/src/simulator/default-simulator-impl.cc	Mon Jan 12 18:46:28 2009 +0000
+++ b/src/simulator/default-simulator-impl.cc	Tue Jan 13 19:27:44 2009 +0000
@@ -124,7 +124,7 @@
 bool 
 DefaultSimulatorImpl::IsFinished (void) const
 {
-  return m_events->IsEmpty ();
+  return m_events->IsEmpty () || m_stop;
 }
 
 uint64_t
--- a/src/simulator/realtime-simulator-impl.cc	Mon Jan 12 18:46:28 2009 +0000
+++ b/src/simulator/realtime-simulator-impl.cc	Tue Jan 13 19:27:44 2009 +0000
@@ -384,7 +384,7 @@
   bool rc;
   {
     CriticalSection cs (m_mutex);
-    rc = m_events->IsEmpty ();
+    rc = m_events->IsEmpty () || m_stop;
   }
 
   return rc;
--- a/src/simulator/simulator.h	Mon Jan 12 18:46:28 2009 +0000
+++ b/src/simulator/simulator.h	Tue Jan 13 19:27:44 2009 +0000
@@ -97,8 +97,9 @@
   static void Destroy (void);
 
   /**
-   * If there any any events lefts to be scheduled, return
-   * true. Return false otherwise.
+   * If there any any events lefts to be scheduled and simulation time
+   * has not yet reached the "stop time" (see Simulator::Stop()),
+   * return true. Return false otherwise.
    */
   static bool IsFinished (void);
   /**