[Lazarus] TFPTimer, Linux

Antonio Fortuny a.fortuny at sitasoftware.lu
Wed Jan 15 15:45:44 CET 2014


Hi Folks.

Following a Michael advice I changed a TTimer by an TFPTime component in 
a Linux daemon application but the latter doesn't work.
There is the code snippet of the TFPTime OnTimer event:

procedure TDaemon1.ThreadControlTimerTimer(Sender: TObject);
var
   Res: Boolean;
begin
   // se réveille toutes les 10 secondes pour vérifier l'état du thread
   FLog.Add(9, '1++++', esError);
   try
     FLog.Add(9, '2++++', esError);
   except
     on E: Exception do begin
       FLog.Error(Format('>>+++ error on log control thread:%s', 
[E.Message]));
       Res := False;
     end;
   end;
   FLog.Add(9, '3++++', esError);
   try

     FLog.Add(9, '4++++', esError);   <<------------- this line appears 
into the log file

     ThreadControlTimer.Enabled := False;

     FLog.Add(9, '5++++', esError);     <<======= this line is never reached

     Res := DoThreadControl;
     FLog.Add(9, '6++++', esError);
   except
     on E: Exception do begin
       FLog.Error(Format('>>+++ error on control thread:%s', [E.Message]));
       Res := False;
     end;
   end;
   if Res then begin
     FLog.Add(9, '7++++ True', esError);
     ThreadControlTimer.Enabled := True;
   end else begin
     FLog.Add(9, '8++++ False', esError);
   end;
end;

It looks like the Enabled property doesn't work and blocks the TFPTimer 
in some way. The event is fired on time, but only once and never more.
I'dl be glad to know what happens.

Antonio.



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com






More information about the Lazarus mailing list