[Lazarus] PostMessage return value
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Sep 15 17:11:01 CEST 2014
On Mon, 15 Sep 2014 21:57:40 +0800
Xiangrong Fang <xrfang at gmail.com> wrote:
>[...]
> That's exactly what I planed to do. But I don't know "CriticalSections" can
> be used in here. My original thinking is that, by the end of Execute, I
> call either PostMessage or QueueAsyncCall to notify main thread that the
> current thread finished its work. The main thread, in its message handler
> then know from a status variable that this thread is in suspended status,
> then assign a new work to it and call its Execute() method again.
Then write your thread Execute as a loop, calling Synchronize.
Synchronize pauses the thread, waiting for the main thread, calling the
method in the main thread, when method ended continuing thread.
See
http://wiki.freepascal.org/Multithreaded_Application_Tutorial
Mattias
More information about the Lazarus
mailing list