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