[fpc-devel] Threading support and C library under Linux/Unix
Michael Schnell
mschnell at lumino.de
Wed Jun 23 16:26:30 CEST 2010
On 06/23/2010 03:56 PM, Henry Vermaak wrote:
>
> We've got this already, then:
>
> http://www.freepascal.org/docs-html/rtl/system/interlockedcompareexchange.html
>
nice !
X86, X68-64: good.
"ARMV6" uses ldrex (seemingly = "load locked"): good
Other ARMs (including thumb2) uses a loop with result compare. AFAIK
this does not work reliably. I am not sure it it's really true that ARM
implements the "atomic region" but if FUTEX is available in the Kernel a
set of reliable atomic user space instructions is provided as well. So
we would need to use this.
PPC, PPC64, Sparc: loop: not reliable
In theory a decent Futex implementation could be done on top of this
(see "futexes are tricky") for X86, X86-64 and ARMV6. For ARMV5 we
should take a look at the implementation of the atomic functions for
Futex ("pthread_mutex...()") done in libc.
-Michael
More information about the fpc-devel
mailing list