diff -r 59f227f48259 src/simulator/default-simulator-impl.cc --- a/src/simulator/default-simulator-impl.cc Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/default-simulator-impl.cc Wed Dec 10 08:24:53 2008 +0100 @@ -49,7 +49,6 @@ DefaultSimulatorImpl::DefaultSimulatorImpl () { m_stop = false; - m_stopAt = 0; // uids are allocated from 4. // uid 0 is "invalid" events // uid 1 is "now" events @@ -146,8 +145,7 @@ DefaultSimulatorImpl::Run (void) { - while (!m_events->IsEmpty () && !m_stop && - (m_stopAt == 0 || m_stopAt > NextTs ())) + while (!m_events->IsEmpty () && !m_stop) { ProcessOneEvent (); } @@ -169,13 +167,6 @@ m_stop = true; } -void -DefaultSimulatorImpl::Stop (Time const &time) -{ - NS_ASSERT (time.IsPositive ()); - Time absolute = Simulator::Now () + time; - m_stopAt = absolute.GetTimeStep (); -} // // Schedule an event for a _relative_ time in the future. diff -r 59f227f48259 src/simulator/default-simulator-impl.h --- a/src/simulator/default-simulator-impl.h Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/default-simulator-impl.h Wed Dec 10 08:24:53 2008 +0100 @@ -45,7 +45,6 @@ virtual bool IsFinished (void) const; virtual Time Next (void) const; virtual void Stop (void); - virtual void Stop (Time const &time); virtual EventId Schedule (Time const &time, EventImpl *event); virtual EventId ScheduleNow (EventImpl *event); virtual EventId ScheduleDestroy (EventImpl *event); @@ -66,7 +65,6 @@ typedef std::list DestroyEvents; DestroyEvents m_destroyEvents; - uint64_t m_stopAt; bool m_stop; Ptr m_events; uint32_t m_uid; diff -r 59f227f48259 src/simulator/realtime-simulator-impl.cc --- a/src/simulator/realtime-simulator-impl.cc Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/realtime-simulator-impl.cc Wed Dec 10 08:24:53 2008 +0100 @@ -68,7 +68,6 @@ NS_LOG_FUNCTION_NOARGS (); m_stop = false; - m_stopAt = 0; m_running = false; // uids are allocated from 4. // uid 0 is "invalid" events @@ -441,16 +440,6 @@ { done = true; } - // - // We also want to stop the simulator at some time even if there are events - // that have been scheduled out in the future. If we're in realtime mode, we - // actually have time passing, so we must look at the realtime clock to see if - // we're past the end time. - // - if (m_stopAt && m_stopAt <= m_synchronizer->GetCurrentRealtime ()) - { - done = true; - } } if (done) @@ -537,37 +526,6 @@ { NS_LOG_FUNCTION_NOARGS (); m_stop = true; -} - -static void Placeholder (void) {} - -// -// Schedule a stop for a _relative_ time in the future. If the simulation -// hasn't started yet, this will effectively be an absolute time. -// -void -RealtimeSimulatorImpl::Stop (Time const &time) -{ - NS_LOG_FUNCTION (time); - - Time tAbsolute = Simulator::Now () + time; - NS_ASSERT (tAbsolute.IsPositive ()); - NS_ASSERT (tAbsolute >= TimeStep (m_currentTs)); - m_stopAt = tAbsolute.GetTimeStep (); - - // - // For the realtime case, we need a real event sitting out at the end of time - // to keep the simulator running (sleeping) while there are no other events - // present. If an "external" device in another thread decides to schedule an - // event, the sleeping synchronizer will be awakened and the new event will - // be run. - // - // The easiest thing to do is to call back up into the simulator to take - // advantage of all of the nice event wrappers. This will call back down into - // RealtimeSimulatorImpl::Schedule to do the work. This path interprets the - // time as relative, so pass the relative time. - // - Simulator::Schedule (time, &Placeholder); } // diff -r 59f227f48259 src/simulator/realtime-simulator-impl.h --- a/src/simulator/realtime-simulator-impl.h Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/realtime-simulator-impl.h Wed Dec 10 08:24:53 2008 +0100 @@ -55,7 +55,6 @@ virtual bool IsFinished (void) const; virtual Time Next (void) const; virtual void Stop (void); - virtual void Stop (Time const &time); virtual EventId Schedule (Time const &time, EventImpl *event); virtual EventId ScheduleNow (EventImpl *event); virtual EventId ScheduleDestroy (EventImpl *event); @@ -89,7 +88,6 @@ typedef std::list DestroyEvents; DestroyEvents m_destroyEvents; - uint64_t m_stopAt; bool m_stop; bool m_running; diff -r 59f227f48259 src/simulator/simulator-impl.h --- a/src/simulator/simulator-impl.h Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/simulator-impl.h Wed Dec 10 08:24:53 2008 +0100 @@ -38,7 +38,6 @@ virtual bool IsFinished (void) const = 0; virtual Time Next (void) const = 0; virtual void Stop (void) = 0; - virtual void Stop (Time const &time) = 0; virtual EventId Schedule (Time const &time, EventImpl *event) = 0; virtual EventId ScheduleNow (EventImpl *event) = 0; virtual EventId ScheduleDestroy (EventImpl *event) = 0; diff -r 59f227f48259 src/simulator/simulator.cc --- a/src/simulator/simulator.cc Tue Dec 09 22:09:12 2008 -0800 +++ b/src/simulator/simulator.cc Wed Dec 10 08:24:53 2008 +0100 @@ -169,7 +169,7 @@ Simulator::Stop (Time const &time) { NS_LOG_FUNCTION (time); - GetImpl ()->Stop (time); + Simulator::Schedule (time, &Simulator::Stop); } Time