[Ns-developers] NS-3 GUI (visualization again)

craigdo at ee.washington.edu craigdo at ee.washington.edu
Tue Jul 29 17:29:29 PDT 2008


[ ... ]

> > RunOne what?  RunOne when?  In what context?
> 
> Run one event from the event queue and return immediately. Gustavo
> suggested adding a bool return value to return whether or not further
> events are left in the queue. A trivial sample implementation:
> 
> bool
> DefaultSimulatorImpl::RunOne (void)
> {
>   if (!m_events->IsEmpty ())
>     {
>       ProcessOneEvent ();
>     }
> 
>   NS_ASSERT(!m_events->IsEmpty () || m_unscheduledEvents == 0);
> 
>   return !m_events->IsEmpty ();
> }
> 
> 
> I thought that the context in which this function would be 
> used would be
> obvious: it could be used to move the mainloop from ns3 to the
> application to allow the application to decide when and how to execute
> events.

Well, not obvious to me, but I haven't been having this conversation with
Gustavo and I'm coming from an entirely different place.  In any case, now I
can answer your question about emu.

This approach is funamentally incompatible with a realtime scheduler unless
you want to move basically the whole multithreaded interruptible-wait
realtime-synchronizer thing up into the GUI application.  Realtime GUI.
Yeah-baby :-)

But it does represent something that can be optional and implemented
differently in different simulator implementations.  In the default
simulator implementation, it makes sense to do something as you show above.
In a realtime scheduler, it would be implemented as,

  bool
  DefaultSimulatorImpl::RunOne (void)
  {
    NS_ASSERT_MSG(false, "No, you really don't want to do that");
    return false;
  }





More information about the Ns-developers mailing list