[Lazarus] PostMessage return value
Michael Schnell
mschnell at lumino.de
Thu Sep 18 11:32:40 CEST 2014
On 09/18/2014 10:32 AM, Xiangrong Fang wrote:
>
> Yesterday I read your ThreadPool source code, and cannot understand
> how you control which thread can get the "Wait" CS, rather than just
> let the 2 thread compete for it. Could you please explain the logic
> behind this?
>
>
Each worker Thread (i.e. the TThreadPoolThread instance) has it's own
"Wait" semaphore (TCriticalSection instance).
The semaphore is owned by the main thread while the worker thread is
supposed to do hold off, waiting to be assigned any work by setting the
appropriate element of the "Tasks" property.
The semaphore is owned by the worker thread when it is working (as
easily seen in the Execute procedure.
-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140918/df725348/attachment-0003.html>
More information about the Lazarus
mailing list