Re: [ROOT] How to use TTimer for a timeout

From: Valeriy Onuchin (Valeri.Onoutchine@cern.ch)
Date: Mon Oct 20 2003 - 19:17:31 MEST


 Hi Thomas, probably somebody corrrect me:
timers are always inside event loop (unixes, win32gdk, except win32 which has
separate thread for timers).
If single-shot timer can help to solve your problem?
Check http://root.cern.ch/root/htmldoc/TTimer.html#TTimer:SingleShot

Regards. Valeriy


> Hi,
> 
> I want to have a simple timeout which I can use a conditional on, like:
> 
> cout << "Start" << endl;
>      TTimer tm(500, kFALSE);
>      tm.TurnOn();
> 
>      while (!tm.HasTimedOut())
>          usleep(1);
>      tm.TurnOff();
> cout << "Timed out." << endl;
> 
> I cannot find out how I can realize this using a TTimer which doesn't
> depend on the eventloop (asynchronous).
> 
> Maybe somebody can help me?
> 
> Thanks in advance,
> Thomas.
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET