[fpc-devel] Threads not working in console application

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Dec 6 13:52:41 CET 2007


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.

I attached a Console test project and the threadtimer.pas unit.  Has
anybody got any ideas as to why it doesn't work in a console app?

BTW:
To get the console app to continue running, I have a loop checking for
a file or sleeps for 500 ms.  The timer is enabled before that loop
starts, so I am supposed to see output to the console.  I added some
debug writeln()'s to know when the time starts or stops and which
events file (application loop or timer event).

Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadtimer.pas
Type: text/x-pascal
Size: 3020 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20071206/24eb7b35/attachment.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.lpr
Type: application/octet-stream
Size: 1786 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20071206/24eb7b35/attachment.obj>


More information about the fpc-devel mailing list