[fpc-devel] Threading support and C library under Linux/Unix
Henry Vermaak
henry.vermaak at gmail.com
Thu Jun 24 11:05:12 CEST 2010
On 24 June 2010 09:00, Michael Schnell <mschnell at lumino.de> wrote:
> On 06/23/2010 09:26 PM, Florian Klämpfl wrote:
>> I'am sure if it's a problem for somebody, he will find a solution and
>> send a patch.
>>
> As the swap instruction seems to be the only atomic memory operation ARM
> lower than v6 can do, there is no possible workaround in user space
> software.
Not without kernel support, see here:
http://www.eglibc.org/cgi-bin/viewcvs.cgi/trunk/ports/sysdeps/arm/bits/atomic.h?rev=77&view=markup
Note the comment:
/* Atomic compare and exchange. These sequences are not actually atomic;
there is a race if *MEM != OLDVAL and we are preempted between the two
swaps. However, they are very close to atomic, and are the best that a
pre-ARMv6 implementation can do without operating system support.
LinuxThreads has been using these sequences for many years. */
The linux specific code is here:
http://www.eglibc.org/cgi-bin/viewcvs.cgi/trunk/ports/sysdeps/unix/sysv/linux/arm/nptl/bits/atomic.h?rev=3063&view=markup
It relies completely on the kernel.
Henry
More information about the fpc-devel
mailing list