[fpc-devel] Threads not working in console application

Michael Van Canneyt michael at freepascal.org
Thu Dec 6 14:21:15 CET 2007



On Thu, 6 Dec 2007, Graeme Geldenhuys wrote:

> Hi,
> 
> I've created a while back a thread based Timer.  At the time I
> developed the timer, I tested it in a Lazarus (LCL) GUI application
> and everything worked perfectly. Just tested it now and it still works
> fine.
> 
> Today I tried to use that Timer in a Console application and a fpGUI
> based application and the timer doesn't work for some reason!  I'm
> using FPC 2.2.0 under Linux.

As far as I can see, you forget to call checksynchronize in the main thread.

BTW. There is a TThreadedTimer in the FCL, based on your code.

Michael.



More information about the fpc-devel mailing list