Re: TApplication & process control

Andrej Filipcic (Andrej.Filipcic@ijs.si)
Fri, 27 Mar 1998 15:31:54 +0100 (MET)


On Fri, 27 Mar 1998, Fons Rademakers wrote:

Dear Fons,

actually I found another way to do that. If there is no input, a call to
gSystem->InnerLoop();
would wait for an input. Is this correct?
So, I created async MyTimer from TTimer and implemented

Bool_t MyTimer::Notify() {
if(gClient->HandleInput()) Reset(); // Should I use gClient->Notify()?
return kFALSE;
}

Then, I do

MyTimer* mytimer = new MyTimer(100);
gSystem->AddTimer(mytimer);
// Loop
gSystem->RemoveTimer(mytimer);
delete mytimer;

This handles Gui events correctly.

Andrej
>
> you should call once in while in your DAQ loop the function:
>
> gSystem->InnerLoop();
>
> this will flush pending graphics, socket and synchronous timer
> events. When pending events have been processed it will return, when
> no events are pending it will wait for an event to happen. To
> prevent this from blocking your app use a timeouttimer like is done
> in the TMonitor class (http://root.cern.ch/root/html/src/TMonitor.cxx.html).
> See TMonitor::Select(Long_t timeout). I might provide a
> TSystem::InnerLoop(Long_t timeout), but for the time being add the time-out
> like in the Select method.
>
> Cheers, Fons.