Guys, this is simply a semantic problem. I've got a six core system here. The boolean array initialised all false. thdArray[0..9] threads executing simultaneously. Corresponding values in baArray[0..9]=false. baArray[n] = true iff thdArray[n] Terminated (method assigned to each member of thdArray
ObserverThread.Execute repeat AllTrue:=CHECK_IF_ALL_IN_baArray_IS_TRUE; WaitForSingleObject(Handle,300); until AllTrue or Terminated ObserverThread WILL ALWAYS terminate AFTER each and every thread has completed. There is no worry about order of completion with this method. On Fri, Oct 8, 2010 at 3:52 PM, Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > > On 08 Oct 2010, at 22:45, Andrew Brunner wrote: > > On Fri, Oct 8, 2010 at 3:37 PM, Marco van de Voort <mar...@stack.nl> wrote: > > No, but the last one might be set before the condition coupled to that last > > one might be carried out. See Jonas' example. > > The ONLY way that could happen is if the boolean happens to be set in > a worker thread's method that still has more work to do. > > That is incorrect. Even if you set the boolean only to true at the very end, > problems can still occur. See > e.g. http://en.wikipedia.org/wiki/Memory_barrier#An_illustrative_example for > an example and explanation. > > Jonas > > _______________________________________________ > fpc-pascal maillist - fpc-pas...@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal