<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 07/22/2016 03:42 AM, Michael Schnell
wrote:<br>
</div>
<blockquote cite="mid:5791CE71.7020500@lumino.de" type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<div class="moz-cite-prefix">On 07/21/2016 11:37 PM, Donald Ziesig
wrote:<br>
</div>
<blockquote
cite="mid:742859de-2300-0151-b4b9-77b545cf0c79@ziesig.org"
type="cite">
<meta content="text/html; charset=utf-8"
http-equiv="Content-Type">
<br>
</blockquote>
TThread.Queue simply schedules an event in the Main Thread queue
(i.e. an event handler procedure will be called when the main
thread next time calls CheckSynchronize() ) .<br>
<br>
TThread.Synchronize additionally stalls the thread that calls
TThread.Synchronize() until the main thread is done with executing
the scheduled event handler procedure. <br>
<br>
-Michael<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<p>Hi Michael,</p>
<p><br>
</p>
<p>I know the difference between Synchronize and Queue.</p>
<p>The problem is that Synchronize appears to suspend the main
thread (but only when used in TFPTimer). I have test programs
that show that TThread.Synchronize properly suspends the calling
thread and executes the callback using the main thread when
TThread is used by itself.</p>
<p>On the other hand, when TThread is subclassed to be the
TFPTimerThread, Synchronize appears to suspend the main thread and
the program hangs. The thread ids are all appropriate
(Synchronize is called from the timer thread) but, once called,
Synchronize never returns and the callback is not executed. When
Synchronize is replaced by Queue, the timer program works as
expected (the timer thread continues execution immediately after
Queue returns, instead of waiting for the callback routine to
finish).</p>
<p><br>
</p>
<p>Both cases behave identically on the Raspberry Pi and Linux Mint
so I believe that the problem lies in the FPC code, not the OS.<br>
</p>
<p><br>
</p>
<p>This does not make any sense to me, but, since the behavior of
TFPTimer (as modified to use Queue) is appropriate for my
application, and I do have a deadline, I will use the modified
TFPTimer and return to this weirdness when my project is done.</p>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Don<br>
</p>
</body>
</html>