]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Renamed __sync_add_and_fetch() into sync_add_and_fetch().
authorBart Van Assche <bvanassche@acm.org>
Sun, 21 Sep 2008 11:21:23 +0000 (11:21 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 21 Sep 2008 11:21:23 +0000 (11:21 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8630

drd/tests/atomic_var.c

index 31adb8fe39f1344052c001f39ffd4766d2ac1d56..3133846ad42b5339c39f2fbb164580c2326193a3 100644 (file)
 
 
 /** Only gcc 4.1.0 and later have atomic builtins. */
-#ifndef HAVE_BUILTIN_ATOMIC
+#if defined(HAVE_BUILTIN_ATOMIC)
 static __inline__
-int __sync_add_and_fetch(int* p, int i)
+int sync_add_and_fetch(int* p, int i)
+{
+  return __sync_add_and_fetch(p, i);
+}
+#else
+static __inline__
+int sync_add_and_fetch(int* p, int i)
 {
   if (i == 0)
     return *p;
@@ -35,13 +41,13 @@ static int s_y = 0;
 static void* thread_func_1(void* arg)
 {
   s_y = 1;
-  (void) __sync_add_and_fetch(&s_x, 1);
+  (void) sync_add_and_fetch(&s_x, 1);
   return 0;
 }
 
 static void* thread_func_2(void* arg)
 {
-  while (__sync_add_and_fetch(&s_x, 0) == 0)
+  while (sync_add_and_fetch(&s_x, 0) == 0)
     ;
   fprintf(stderr, "y = %d\n", s_y);
   return 0;