[fpc-pascal] Is TFPList thread safe?

Michael Schnell mschnell at lumino.de
Thu Oct 2 16:09:31 CEST 2014


On 10/02/2014 08:16 AM, Michael Van Canneyt wrote:
>
> Critical sections use OS calls, so there is always a performance penalty.

That is what Futex is made for.

AFAIR, in Linux, the fpc RTL calls the pthread library "mutex..." 
function. This library uses Futex, if the arch supports that, and uses 
the plain old MUTEX system call if the arch does not support FUTEX.

("FUTEX" = " Fast Userland MutEX" only does an OS call when necessary 
(i.e. when a thread needs to wait or when another thread needs to be 
woke). So in by fat most instances it just does a (atomic) userland 
operation.)

-Michael




More information about the fpc-pascal mailing list