On 07/12/2010 04:26 PM, Frank Church wrote:
The code is running in a TProcess executing command prompt programs rather than from an API,
You mean it's a no-GUI project ?
In fact, at the moment, Lazarus lacks a Application Template and Widget Type for programs that need TTimer (and similar things) but are supposed to run in a (Linux) system that does not provide a GUI API, Here using Threads can be a work-around.

Do you in fact want to run your program on a system that does not provide a GUI API ? Otherwise you can just do a normal (GUI enabled) application and hide the main form.
My preferred approach is that even if the thread is suspended during the Synchronize period, it should remain suspended until a timer running in the main thread kicks it of again. I think testing the thread's *while not terminated* loop to see if it is time yet is an inefficent use of resources.
Of course you are right that "busy spinning" always is a bad idea. As said, a suspended thread needs to be woken by another thread. In most cases there are better synchronizing options than using "suspend". (TEvent, TCriticalSection, ...)

-Michael
(BTW.;: Do not top-post. This makes the Forum Thread hard to read.)
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to