View | Details | Raw Unified | Return to bug 1410
Collapse All | Expand All

(-)a/src/core/test/threaded-test-suite.cc (-4 / +2 lines)
 Lines 196-202    Link Here 
196
      m_threadlist.push_back(
196
      m_threadlist.push_back(
197
        Create<SystemThread> (MakeBoundCallback (
197
        Create<SystemThread> (MakeBoundCallback (
198
            &ThreadedSimulatorEventsTestCase::SchedulingThread, 
198
            &ThreadedSimulatorEventsTestCase::SchedulingThread, 
199
                std::pair<ThreadedSimulatorEventsTestCase *, unsigned int>(this,1) )) );
199
                std::pair<ThreadedSimulatorEventsTestCase *, unsigned int>(this,i) )) );
200
    }
200
    }
201
}
201
}
202
void 
202
void 
 Lines 209-214    Link Here 
209
void 
209
void 
210
ThreadedSimulatorEventsTestCase::DoRun (void)
210
ThreadedSimulatorEventsTestCase::DoRun (void)
211
{
211
{
212
  m_stop = false;
212
  Simulator::SetScheduler (m_schedulerFactory);
213
  Simulator::SetScheduler (m_schedulerFactory);
213
214
214
  Simulator::Schedule (MicroSeconds (10), &ThreadedSimulatorEventsTestCase::A, this, 1);
215
  Simulator::Schedule (MicroSeconds (10), &ThreadedSimulatorEventsTestCase::A, this, 1);
 Lines 219-230    Link Here 
219
    {
220
    {
220
      (*it)->Start();
221
      (*it)->Start();
221
    }
222
    }
222
  
223
  Simulator::Run ();
223
  Simulator::Run ();
224
  Simulator::Destroy ();
224
  Simulator::Destroy ();
225
225
226
  m_stop = true;
227
228
  NS_TEST_EXPECT_MSG_EQ (m_error.empty(), true, m_error.c_str());
226
  NS_TEST_EXPECT_MSG_EQ (m_error.empty(), true, m_error.c_str());
229
  NS_TEST_EXPECT_MSG_EQ (m_a, m_b, "Bad scheduling");
227
  NS_TEST_EXPECT_MSG_EQ (m_a, m_b, "Bad scheduling");
230
  NS_TEST_EXPECT_MSG_EQ (m_a, m_c, "Bad scheduling");
228
  NS_TEST_EXPECT_MSG_EQ (m_a, m_c, "Bad scheduling");
(-)a/src/visualizer/model/pyviz.cc (-14 / +8 lines)
 Lines 265-272    Link Here 
265
PyViz::CallbackStopSimulation ()
265
PyViz::CallbackStopSimulation ()
266
{
266
{
267
  NS_LOG_FUNCTION_NOARGS ();
267
  NS_LOG_FUNCTION_NOARGS ();
268
  Simulator::Stop (Seconds (0)); // Stop right now
268
  if (m_runUntil <= Simulator::Now ())
269
  m_stop = true;
269
    {
270
      Simulator::Stop (Seconds (0)); // Stop right now
271
      m_stop = true;
272
    }
270
}
273
}
271
274
272
void
275
void
 Lines 316-335    Link Here 
316
  // sure we stop at the right time.  Otherwise, simulations with few
319
  // sure we stop at the right time.  Otherwise, simulations with few
317
  // events just appear to "jump" big chunks of time.
320
  // events just appear to "jump" big chunks of time.
318
  NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ()));
321
  NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ()));
322
  m_runUntil = time;
319
  m_stop = false;
323
  m_stop = false;
320
  Simulator::Cancel (m_stopCallbackEvent);
324
  Simulator::ScheduleWithContext (0xffffffff, time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
321
  m_stopCallbackEvent = Simulator::Schedule (time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
322
325
323
  Ptr<SimulatorImpl> impl = Simulator::GetImplementation ();
326
  Simulator::Run()
324
  Ptr<VisualSimulatorImpl> visualImpl = DynamicCast<VisualSimulatorImpl> (impl);
325
  if (visualImpl)
326
    {
327
      visualImpl->RunRealSimulator ();
328
    }
329
  else
330
    {
331
      impl->Run ();
332
    }
333
}
327
}
334
328
335
bool PyViz::TransmissionSampleKey::operator < (PyViz::TransmissionSampleKey const &other) const
329
bool PyViz::TransmissionSampleKey::operator < (PyViz::TransmissionSampleKey const &other) const
(-)a/src/visualizer/model/pyviz.h (-1 / +1 lines)
 Lines 220-226    Link Here 
220
  void DoPause (std::string const &message);
220
  void DoPause (std::string const &message);
221
221
222
  bool m_stop;
222
  bool m_stop;
223
  EventId m_stopCallbackEvent;
223
  Time m_runUntil;
224
  void CallbackStopSimulation ();
224
  void CallbackStopSimulation ();
225
};
225
};
226
226

Return to bug 1410