On Wed, 15 Jan 2014, Antonio Fortuny wrote:
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.
DaemonApp works using threads.
TFPTimer is not usable in threads other than the main thread.
Michael.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus