[fpc-pascal] Where is IsMultiThreaded set under Linux?

Andrew Brunner andrew.t.brunner at gmail.com
Fri Oct 8 23:04:39 CEST 2010


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.maebe at 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 <marcov at 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-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list