<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 07/12/2010 04:26 PM, Frank Church wrote:
<blockquote
cite="mid:AANLkTilwqcK7wuc6jxcPzTZ9C7R3M1iJah1kqCuEtBvS@mail.gmail.com"
type="cite">The code is running in a TProcess executing command
prompt programs rather than from an API, </blockquote>
You mean it's a no-GUI project ? <br>
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.<br>
<br>
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.<br>
<blockquote
cite="mid:AANLkTilwqcK7wuc6jxcPzTZ9C7R3M1iJah1kqCuEtBvS@mail.gmail.com"
type="cite">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 <b>while not terminated</b>
loop to see if it is time yet is an inefficent use of resources.<br>
</blockquote>
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, ...)<br>
<br>
-Michael<br>
(BTW.;: Do not top-post. This makes the Forum Thread hard to read.)<br>
</body>
</html>