[linux-audio-dev] lock-free ring buffer code
Paul Davis
paul at linuxaudiosystems.com
Tue Apr 8 13:58:01 UTC 2003
>> The glibc has internal support for atomic operations (at least
>> atomic_add() is there and allows a negative argument, so
>> atomic_sub() is there too and exchange_and_add(&lff->filled, 0)
>> will provide an atomic read), so there is no problem about
>> portability on Linux systems (and even other systems).
>
>You should probably special case architectures where 32bit read/write is
>atomic, as its a common case at the moment.
the kernel code for atomic_t does this already. atomic_inc(atomic_t* a)
resolves to a++ or something like that.
--p
More information about the Linux-audio-dev
mailing list