This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
built-in atomic functions
- From: manju k <m_a_n_j_u_s_k at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 30 Aug 2010 01:05:48 -0700 (PDT)
- Subject: built-in atomic functions
Hello,
Are there any new built-in implementations equivalent to atomic_read and
atomic_write in latest releases ?
if not should I rely on trick suggested in one of the earlier discussions as
below ?
">>We don't have atomic read or atomic write builtins (ok, you could
>>abuse __sync_fetch_and_add (&x, 0) for atomic read and a loop
>>with __sync_compare_and_swap_val for atomic store, but that's a horrible
>>overkill."
Also I am looking for atomic_set, I do not see any __sync* functions.
but from atomic.h, atomic_set just does a normal assignment, so doing the same
should be safe enough?
Thanks for any help.
Thanks and Regards,
Manju