This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: atomic operations
- From: Tim Prince <TimothyPrince at sbcglobal dot net>
- To: "Vardhan, Sundara (GE Infra, Energy)" <sundara dot vardhan at ge dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 26 Apr 2008 07:29:11 -0700
- Subject: Re: atomic operations
- References: <8E460D1B58F94945A20AA70D4D41430D052DE881@ALPMLVEM08.e2k.ad.ge.com>
- Reply-to: tprince at computer dot org
Vardhan, Sundara (GE Infra, Energy) wrote:
Are there any atomic operations available. I am looking for something equivalent to atomic_swap_uchar in Solaris. I tried to use __sync_val_compare_and_swap() but get errors when the program tries to load it in runtime. Perhaps I need to link or download some libraries. Any idea which?
I guess this is controversial, with wildly varying points of view. From
my point of view, the built-in gcc support for atomic is what OpenMP
provides. For the targets I know of where gcc implements OpenMP, I
believe it's done via pthread_mutex.
You could check for the implementation of __sync_ buitins for your target:
http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html