[ltt-dev] Userspace RCU library relicensed to LGPLv2.1

Jan Blunck jblunck at suse.de
Thu May 14 09:46:22 EDT 2009

On Thu, May 14, Mathieu Desnoyers wrote:

> If we look at
> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
> The instruction closest to an xchg() instruction (to exchange a pointer
> in memory) is :
> "type __sync_lock_test_and_set (type *ptr, type value, ...)

Couldn't you make us of the following?

type __sync_val_compare_and_swap (type *ptr, type oldval type newval, ...)

    These builtins perform an atomic compare and swap. That is, if the current
    value of *ptr is oldval, then write newval into *ptr. 

At least __sync_lock_test_and_set() and  __sync_lock_release() seem to be only
usable when implementing spin locks.


Jan Blunck <jblunck at suse.de>

More information about the lttng-dev mailing list