----- Original Message ----- From: "Anton Fokin" <anton.fokin@smartquant.com> To: "roottalk" <roottalk@pcroot.cern.ch> Sent: Monday, March 18, 2002 6:31 AM Subject: [ROOT] Another bug in TTimer on windows > Hello, > > single shot async mode doesn't work under windows (dont know about Linux) > > This below doesn't trigger timer (HandleTimer) at all > > fTimer = new TTimer(this, 1000, kFALSE); > fTimer->Start(1000, kTRUE); > > Although this > > fTimer = new TTimer(this, 1000, kFALSE); > fTimer->Start(1000); > > does (constantly). Anton, why each time one has to ask you one and the same thing to be provided ? - A simple test or example to reproduce the problem. - If you have found a problem reason and fix it then the correction and test are appreciated. Can you memorize that ;-) Coming back to the problem you reported: I did not know about Start method. I've looked it up. From the first glance it is NOT correct. http://root.cern.ch/root/html/src/TTimer.cxx.html#TTimer:Start void TTimer::Start(Int_t milliSec, Bool_t singleShot) { if (milliSec >= 0) SetTime(milliSec); Reset(); TurnOn(); if (singleShot) Connect(this, "Timeout()", "TTimer", this, "TurnOff()"); else Disconnect(this, "Timeout()", this, "TurnOff()"); } My guess the methods Connect/Disconnect may have been called too late. To avoid the problem I would recommend to change the order of the methods above, namely: void TTimer::Start(Int_t milliSec, Bool_t singleShot) { if (milliSec >= 0) SetTime(milliSec); Reset(); // TurnOn(); // move this statement if (singleShot) Connect(this, "Timeout()", "TTimer", this, "TurnOff()"); else Disconnect(this, "Timeout()", this, "TurnOff()"); TurnOn(); // New position of the method } I mean FIRST the signal/slot connection must be established and THEN the timer should be fired but ... TurnOn http://root.cern.ch/root/html/src/TTimer.cxx.html#TTimer:TurnOn calls Disconnect(this, "Timeout()", this, "TurnOff()"); ??? That is NOT what we want for the single shot case. I wonder if one can provide the timeout that is long enough to get Signal/Slot connection made established then everything should (?) work properly with no change. Can one check this ? Thank you Best regards, Valeri > > /Anton > > http://www.smartquant.com > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:46 MET