[fpc-devel] question about thread.WaitFor

Martin fpc at mfriebe.de
Sun Nov 11 17:58:32 CET 2018


Hi,

assuming code like this.
   SomeThread.Terminate;
   SomeThread.WaitFor;

and assuming that SomeThread has at some time before that done
   Thread.Queue(..., SomeHandler)
And the queued item had not run yet.

Is WaitFor guaranteed (or supposed) do have the queued message handled?

I know it waits for thread.Syncronize(), because the thread waits, and 
it waits for the thread.
I also checked that 3.0.4 done *not* wait for the queued message (it may 
process it, but that is random).

I assume that if the code (in the main thread) wants to be sure, that 
SomeHandler (from the queued event) is not called anymore, then it has 
to explicitly call CheckSynchronize() ?





More information about the fpc-devel mailing list