[fpc-devel] Xe3 Parallel for
Michael Schnell
mschnell at lumino.de
Wed May 13 10:52:56 CEST 2015
On 05/12/2015 05:39 PM, Sven Barth wrote:
>
> Why should that interfere in any kind?! Behind the scenes it's
> propably using TThread anyway...
>
Because Foreground code (here the calls made by the "visible" code the
user creates to use "TParallel") and the "background code" in the
threads that TParallel might create, communicate (i.e. the Thread
notifying the foreground code about a state such as "ready") via the
Event-Queue and for this the foreground code need to call
CheckSynchronize().
But CheckSynchronize() needs to be "manually" done by the user in a pure
FPC project. Only with projects using the LCL (or mse-gui or whatever
framework), this is done without the user explicitly creating code for
this.
How else should "SW.Stop;" in the example work ?
OK, "TStopWatch.Stop;" might call CheckSynchronize() in a loop with a
timeout definable as a property of TStopWatch. This hopefully will not
interfere with other CheckSynchronize() calls done e.g. by the LCL.
-Michael
More information about the fpc-devel
mailing list