Bugzilla – Bug 1417
DefaultSimulatorImpl no longer allows scheduling from multiple threads
Last modified: 2012-04-24 08:41:50 EDT
The DefaultSimulatorImpl no longer allows scheduling from multiple threads. It seems to note which is the "main" thread and asserts that only this thread can schedule events. DefaultSimulatorImpl::Schedule (Time const &time, EventImpl *event) { NS_ASSERT_MSG (SystemThread::Equals (m_main), "Simulator::Schedule Thread-unsafe invocation!"); This breaks the visualizer in some cases (namely when you run it from a python simulation script). The visualizer can call Simulator::Schedule from multiple (2) threads, but it use a mutex to make sure only one thread at a time can call the ns-3 API. This assert is excessive. cf. bug 631 comments.
this seems to be a duplicate of bug 1410.
*** This bug has been marked as a duplicate of bug 1410 ***
Just a FYI, this is assert is not going away unless you find a safe way to know for sure that ::Run is _really_ not running in another thread so, it would be a good idea to find a better way to do what you want to do in the visualizer.
(In reply to comment #3) > Just a FYI, this is assert is not going away unless you find a safe way to know > for sure that ::Run is _really_ not running in another thread so, it would be a > good idea to find a better way to do what you want to do in the visualizer. How about Simulator::Lock() and Simulator::Unlock(), for safe multithreading? It would be trivial to switch pyviz to use that.