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_win_DEFINED | 8 #ifndef SkAtomics_win_DEFINED |
9 #define SkAtomics_win_DEFINED | 9 #define SkAtomics_win_DEFINED |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // InterlockedDecrement returns the new value, we want to return the old. | 33 // InterlockedDecrement returns the new value, we want to return the old. |
34 return _InterlockedDecrement(reinterpret_cast<long*>(addr)) + 1; | 34 return _InterlockedDecrement(reinterpret_cast<long*>(addr)) + 1; |
35 } | 35 } |
36 | 36 |
37 static inline void sk_membar_acquire__after_atomic_dec() { } | 37 static inline void sk_membar_acquire__after_atomic_dec() { } |
38 | 38 |
39 static inline bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after) { | 39 static inline bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after) { |
40 return _InterlockedCompareExchange(reinterpret_cast<long*>(addr), after, bef
ore) == before; | 40 return _InterlockedCompareExchange(reinterpret_cast<long*>(addr), after, bef
ore) == before; |
41 } | 41 } |
42 | 42 |
| 43 static inline void* sk_atomic_cas(void** addr, void* before, void* after) { |
| 44 return InterlockedCompareExchangePointer(addr, after, before); |
| 45 } |
| 46 |
43 static inline void sk_membar_acquire__after_atomic_conditional_inc() { } | 47 static inline void sk_membar_acquire__after_atomic_conditional_inc() { } |
44 | 48 |
45 #endif | 49 #endif |
OLD | NEW |