|
From: <sv...@va...> - 2008-09-21 11:21:30
|
Author: bart
Date: 2008-09-21 12:21:23 +0100 (Sun, 21 Sep 2008)
New Revision: 8630
Log:
Renamed __sync_add_and_fetch() into sync_add_and_fetch().
Modified:
trunk/drd/tests/atomic_var.c
Modified: trunk/drd/tests/atomic_var.c
===================================================================
--- trunk/drd/tests/atomic_var.c 2008-09-21 09:31:15 UTC (rev 8629)
+++ trunk/drd/tests/atomic_var.c 2008-09-21 11:21:23 UTC (rev 8630)
@@ -15,10 +15,16 @@
/** 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;
return (*p += i);
@@ -35,13 +41,13 @@
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;
|