diff -r 791a1b447304 src/core/test/threaded-test-suite.cc --- a/src/core/test/threaded-test-suite.cc Sat Mar 31 10:02:25 2012 +0200 +++ b/src/core/test/threaded-test-suite.cc Tue Apr 24 16:03:22 2012 +0200 @@ -196,7 +196,7 @@ m_threadlist.push_back( Create (MakeBoundCallback ( &ThreadedSimulatorEventsTestCase::SchedulingThread, - std::pair(this,1) )) ); + std::pair(this,i) )) ); } } void @@ -209,6 +209,7 @@ void ThreadedSimulatorEventsTestCase::DoRun (void) { + m_stop = false; Simulator::SetScheduler (m_schedulerFactory); Simulator::Schedule (MicroSeconds (10), &ThreadedSimulatorEventsTestCase::A, this, 1); @@ -219,12 +220,9 @@ { (*it)->Start(); } - Simulator::Run (); Simulator::Destroy (); - m_stop = true; - NS_TEST_EXPECT_MSG_EQ (m_error.empty(), true, m_error.c_str()); NS_TEST_EXPECT_MSG_EQ (m_a, m_b, "Bad scheduling"); NS_TEST_EXPECT_MSG_EQ (m_a, m_c, "Bad scheduling"); diff -r 791a1b447304 src/visualizer/model/pyviz.cc --- a/src/visualizer/model/pyviz.cc Sat Mar 31 10:02:25 2012 +0200 +++ b/src/visualizer/model/pyviz.cc Tue Apr 24 16:03:22 2012 +0200 @@ -265,8 +265,11 @@ PyViz::CallbackStopSimulation () { NS_LOG_FUNCTION_NOARGS (); - Simulator::Stop (Seconds (0)); // Stop right now - m_stop = true; + if (m_runUntil <= Simulator::Now ()) + { + Simulator::Stop (Seconds (0)); // Stop right now + m_stop = true; + } } void @@ -316,20 +319,11 @@ // sure we stop at the right time. Otherwise, simulations with few // events just appear to "jump" big chunks of time. NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ())); + m_runUntil = time; m_stop = false; - Simulator::Cancel (m_stopCallbackEvent); - m_stopCallbackEvent = Simulator::Schedule (time - Simulator::Now (), &PyViz::CallbackStopSimulation, this); + Simulator::ScheduleWithContext (0xffffffff, time - Simulator::Now (), &PyViz::CallbackStopSimulation, this); - Ptr impl = Simulator::GetImplementation (); - Ptr visualImpl = DynamicCast (impl); - if (visualImpl) - { - visualImpl->RunRealSimulator (); - } - else - { - impl->Run (); - } + Simulator::Run() } bool PyViz::TransmissionSampleKey::operator < (PyViz::TransmissionSampleKey const &other) const diff -r 791a1b447304 src/visualizer/model/pyviz.h --- a/src/visualizer/model/pyviz.h Sat Mar 31 10:02:25 2012 +0200 +++ b/src/visualizer/model/pyviz.h Tue Apr 24 16:03:22 2012 +0200 @@ -220,7 +220,7 @@ void DoPause (std::string const &message); bool m_stop; - EventId m_stopCallbackEvent; + Time m_runUntil; void CallbackStopSimulation (); };