[Lazarus] library initialization finalization syntax
Bernd Kreuss
prof7bit at googlemail.com
Sat Feb 20 16:42:38 CET 2010
the problem is, that a normal thread does not have a message queue.
You can create a second thread, which calls some method in a periodic
cycle and sleeps in between. But you must take care, that this thread is
synchronized to your daemon thread.
Adrian.
Am 19.02.2010 16:19, schrieb Joshua Lim:
> Hi Michael, thanks, is there a work around solution to simulating a trigger in a Lazdaemon?
>
> Rgds,
> Joshua
>
>
>
> ------------------------------------------------------------------------
> From: *Michael Van Canneyt*
> The standard driver for fpTimer is not suitable for use in a daemon
> application, as the timer events are only triggered in the main thread,
> and each daemon runs in its own thread.
>
> Michael.
>
>
> ------------------------------------------------------------------------
> From: joshua__lim
> To: lazarus at lists.lazarus.freepascal.org
> Subject: Having trouble getting fptimer to work in a Daemon.
> Date: Mon, 15 Feb 2010 10:02:48 +0000
>
> Hi,
>
> I'm a pascal newbie, after spending some time getting a daemon to
> work, I now have trouble getting a timer to work. I was recommended to
> use TFPTimer from the fpTimer unit -
> http://mantis.freepascal.org/view.php?id=14118&nbn=5
>
> I tried the following code but the OnTimer doesn't trigger. There are
> no errors either. Grateful for any pointers. :)
>
> uses
> fpTimer;
> ...
> TDaemon1 = class(TDaemon)
> ....
> private
> .....
> public
> procedure FTimerTimer( Sender : TObject );
> .....
> var
> Daemon1: TDaemon1;
> FTimer : TFPTimer;
> .....
> procedure TDaemon1.FTimerTimer( Sender : TObject );
> var
> ...
> BEGIN
> ....
> END;
>
> procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var OK: boolean);
> var
> ...
> begin
> FTimer := TFPTimer.Create(nil);
> &nbs
> p;FTimer.OnTimer := @FTimerTimer;
> FTimer.Interval := 1000; // in milliseconds
> FTimer.Enabled := True;
> FTimer.StartTimer;
>
>
>
> Note: I've also posted here -
> http://lazarus.freepascal.org/index.php/topic,8615.0.html
>
>
>
> ------------------------------------------------------------------------
> Hotmail: Free, trusted and rich email service. Get it now.
> <https://signup.live.com/signup.aspx?id=60969>
> ------------------------------------------------------------------------
> Hotmail: Free, trusted and rich email service. Get it now.
> <https://signup.live.com/signup.aspx?id=60969>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100219/84e75567/attachment-0004.html>
More information about the Lazarus
mailing list