1 From: Roland Stigge <stigge@antcom.de>
2 Date: Tue, 21 May 2013 15:09:00 +0200
3 Subject: Fix_FTBFS_on_atomic_operations
6 src/include/thread.h | 8 ++++----
7 1 file changed, 4 insertions(+), 4 deletions(-)
9 diff --git a/src/include/thread.h b/src/include/thread.h
10 index e389ebb..4735796 100644
11 --- a/src/include/thread.h
12 +++ b/src/include/thread.h
13 @@ -220,7 +220,7 @@ inline int
14 atomic_exchange_and_add (volatile int *at, int x)
16 #ifdef USE_GCC_ATOMICS
17 - return __sync_fetch_and_add ((int *)at, x);
18 + return __atomic_fetch_add ((int *)at, x, __ATOMIC_SEQ_CST);
20 atomic<int> *a = (atomic<int> *)at;
21 return a->fetch_and_add (x);
22 @@ -238,7 +238,7 @@ inline long long
23 atomic_exchange_and_add (volatile long long *at, long long x)
25 #ifdef USE_GCC_ATOMICS
26 - return __sync_fetch_and_add (at, x);
27 + return __atomic_fetch_add (at, x, __ATOMIC_SEQ_CST);
29 atomic<long long> *a = (atomic<long long> *)at;
30 return a->fetch_and_add (x);
31 @@ -266,7 +266,7 @@ inline bool
32 atomic_compare_and_exchange (volatile int *at, int compareval, int newval)
34 #ifdef USE_GCC_ATOMICS
35 - return __sync_bool_compare_and_swap (at, compareval, newval);
36 + return __atomic_compare_exchange_n (at, &compareval, newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
38 atomic<int> *a = (atomic<int> *)at;
39 return a->compare_and_swap (newval, compareval) == newval;
40 @@ -283,7 +283,7 @@ inline bool
41 atomic_compare_and_exchange (volatile long long *at, long long compareval, long long newval)
43 #ifdef USE_GCC_ATOMICS
44 - return __sync_bool_compare_and_swap (at, compareval, newval);
45 + return __atomic_compare_exchange_n (at, &compareval, newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
47 atomic<long long> *a = (atomic<long long> *)at;
48 return a->compare_and_swap (newval, compareval) == newval;