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

Gustavo Carneiro gjcarneiro at gmail.com
Tue Jul 29 12:11:28 PDT 2008


2008/7/29 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>

>
> On Tue, 2008-07-29 at 19:13 +0100, Gustavo Carneiro wrote:
>
> >    4- Because of thread safety, we need a "simulator mutex", to keep the
> GUI
> > from looking into ns-3 at the wrong time:
> >        a) The simulation thread normally holds the mutex locked;
> >        b) The GUI periodically tries to acquire the mutex in order to
> peek
> > into the simulation state, then releases it again;
> >        c) The simulation thread periodically releases the mutex and
> > reacquires it again, just to give the GUI a chance to acquire it (same
> > technique used by gtk+ for threading).
>
> The best option for you here would be to add API to simulator.h looking
> like this:
>
> class Simulator {
> public:
> static void RunOne (void);
> };
>
> And, then, to implement your own while loop with a mutex if you wish to
> (you could also call RunOne from an idle handler).


I think this would be useful to me, yes.  Although I think that the function
should return bool to indicate when there are no more pending events to
process, right?

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list