[Lazarus] Lazarus and Application.ProcessMessages

Frederic Da Vitoria davitofrg at gmail.com
Thu Dec 4 19:08:27 CET 2014


2014-12-04 18:20 GMT+01:00 Paul Breneman <list2010 at brenemanlabs.com>:

> On 12/03/2014 04:51 PM, Paul Breneman wrote:
>
>> On 12/03/2014 04:37 PM, Terry A. Haimann wrote:
>>
>>> I have a program that starts some background processes and then needs to
>>> go to sleep for 15 seconds or so and then come back and check on their
>>> statuses.  So I used a loop like the following:
>>>
>>> EndTime := Now + EncodeTime(0, 0, 15, 0);
>>> While Now < EndTime do
>>>        Application.ProcessMessages;
>>>
>>> The problem  is that the core this process runs on is running 60-80% cpu
>>> utilization.  Is there away to do something like this and not max the
>>> core out?  This computer is an i5 Desktop running Linux Mint 17-64.
>>>
>>> Thanks in advance,    T.
>>>
>>
>> The quickest thing to do is to put Sleep(10) inside the while loop. That
>> will help you get longer battery life on a laptop and a cooler CPU!
>>
>> But I would normally use a separate thread.  There are a number of
>> examples here (see ExThread---):
>>    http://turbocontrol.com/APro.htm
>> If you search CodeNewsFast you might be able to turn up a number on
>> explanations on why I recommend using a separate thread.
>>
>> Regards,
>> Paul
>> www.TurboControl.com
>>
>
> I'm replying a second time as my first reply didn't get posted (yet).
>
> Here is a message that has my (old) summary: :)
> http://codenewsfast.com/cnf/article/0/permalink.art-ng1824q786


FWIW, your previous message did reach me:

Received: by 10.152.234.229 with SMTP id uh5csp19639lac;
        Wed, 3 Dec 2014 14:51:27 -0800 (PST)


-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141204/e59729e3/attachment-0003.html>


More information about the Lazarus mailing list