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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to