Make Simulator::IsFinished () take into account the stop time. Needed to run custom simulation loops (see bug 375)
--- 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);
/**