--- a/examples/realtime/realtime-udp-echo.cc Fri Aug 20 12:17:19 2010 -0700 +++ a/examples/realtime/realtime-udp-echo.cc Fri Oct 01 09:19:36 2010 +0200 @@ -113,6 +113,7 @@ // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation."); + Simulator::Stop (Seconds(10.)); Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); --- a/src/simulator/realtime-simulator-impl.cc Fri Aug 20 12:17:19 2010 -0700 +++ a/src/simulator/realtime-simulator-impl.cc Fri Oct 01 09:19:36 2010 +0200 @@ -427,27 +427,22 @@ m_running = true; m_synchronizer->SetOrigin (m_currentTs); - for (;;) + while (!m_stop) { - bool done = false; + bool process = false; { CriticalSection cs (m_mutex); - // - // In all cases we stop when the event list is empty. If you are doing a - // realtime simulation and you want it to extend out for some time, you must - // call StopAt. In the realtime case, this will stick a placeholder event out - // at the end of time. - // - if (m_stop || m_events->IsEmpty ()) + + if (!m_events->IsEmpty ()) { - done = true; + process = true; } } - if (done) + if (!process) { - break; + continue; } ProcessOneEvent ();