Bug#727621: armv5 and ATOMIC_INT_LOCK_FREE
On Mon, 2 Dec 2013, Riku Voipio wrote:
> Hi,
>
> According the debian bug report [1], it is not possible to use std::future
> on armv5 targetting toolchains. This is because libstdc++ will only enable
> std::future if ATOMIC_INT_LOCK_FREE > 1. There is no LDREX for armv5 and
> older, so this definition is set to ATOMIC_INT_LOCK_FREE when compiling for
> ARMv4t or ARMv5.
>
> My impression is that you should be able to use the kernel helpers for
> atomic operations in lockfree (?) manner, so the ATOMIC_INT_LOCK_FREE
> definition is probably incorrect on older arm archs then?
You're absolutely right.
Please see Documentation/arm/kernel_user_helpers.txt in the kernel
source tree for details. There is even an example implementation for
atomic_add() there.
Also I remember gcc being added some native atomic operation support at
some point and they were implemented in terms of the kernel helpers when
the architecture level wasn't high enough to benefit from load/store
exclusive instructions.
Nicolas
Reply to: