[Lazarus] timer in a console application

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Aug 10 14:41:28 CEST 2012



Am 2012-08-10 14:28, schrieb Michael Schnell:
> On 08/10/2012 01:47 PM, Andrea Mauri wrote:
>>
>> Must I use in some way the threads?
>>
> That is exactly what Michael vC said in his mail.
> In a  console application the main thread just starts, does some calculations and runs right until returning and with that terminates the program. If you want to so a longer living thingy, you need to hols the main thread e.g with sleep(). If during that time some "Event" needs to be handled, only a thread can do this.
>
This is not necessariliy how it has to be. I have lots of programs that have a simple endless loop with a delay() that checks for something in regular time slots:

repeat
    check something;
    delay(100000);
until false;





More information about the Lazarus mailing list