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

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Oct 8 16:04:44 CEST 2010


On 08 Oct 2010, at 15:57, Andrew Brunner wrote:

> A better way of achieving this is looking at the collection of threads
> you have.  Set your own booleans for Finished or if they
> freeonterminate you will need to create an
> TCompletes=Array[0..threadcount] of boolean.  And as the threads free
> set the variable of TCompletes to true.  Then you can poll the
> Completes to see if they are all true.
>
> There are a million ways to accomplish safe thread usage without  
> waitfor...

Yes, but the alternatives above are only safe if you only use atomic  
operations (which could be quite slow in case of an array of booleans  
due to the atomic reservation granularity), or if you add proper  
memory barriers everywhere.


Jonas



More information about the fpc-pascal mailing list