OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkAtomics_sync_DEFINED | 8 #ifndef SkAtomics_sync_DEFINED |
9 #define SkAtomics_sync_DEFINED | 9 #define SkAtomics_sync_DEFINED |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 static inline __attribute__((always_inline)) void sk_membar_acquire__after_atomi
c_dec() { } | 27 static inline __attribute__((always_inline)) void sk_membar_acquire__after_atomi
c_dec() { } |
28 | 28 |
29 static inline __attribute__((always_inline)) bool sk_atomic_cas(int32_t* addr, | 29 static inline __attribute__((always_inline)) bool sk_atomic_cas(int32_t* addr, |
30 int32_t before, | 30 int32_t before, |
31 int32_t after) { | 31 int32_t after) { |
32 return __sync_bool_compare_and_swap(addr, before, after); | 32 return __sync_bool_compare_and_swap(addr, before, after); |
33 } | 33 } |
34 | 34 |
| 35 static inline __attribute__((always_inline)) void* sk_atomic_cas(void** addr, |
| 36 void* before, |
| 37 void* after) { |
| 38 return __sync_val_compare_and_swap(addr, before, after); |
| 39 } |
| 40 |
35 static inline __attribute__((always_inline)) void sk_membar_acquire__after_atomi
c_conditional_inc() { } | 41 static inline __attribute__((always_inline)) void sk_membar_acquire__after_atomi
c_conditional_inc() { } |
36 | 42 |
37 #endif | 43 #endif |
OLD | NEW |