OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkThread_DEFINED | 8 #ifndef SkThread_DEFINED |
9 #define SkThread_DEFINED | 9 #define SkThread_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 * This must act as a release (SL/S) memory barrier and as a compiler barrier. | 26 * This must act as a release (SL/S) memory barrier and as a compiler barrier. |
27 */ | 27 */ |
28 static int32_t sk_atomic_dec(int32_t* addr); | 28 static int32_t sk_atomic_dec(int32_t* addr); |
29 | 29 |
30 /** Atomic compare and set. | 30 /** Atomic compare and set. |
31 * If *addr == before, set *addr to after and return true, otherwise return fal
se. | 31 * If *addr == before, set *addr to after and return true, otherwise return fal
se. |
32 * This must act as a release (SL/S) memory barrier and as a compiler barrier. | 32 * This must act as a release (SL/S) memory barrier and as a compiler barrier. |
33 */ | 33 */ |
34 static bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after); | 34 static bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after); |
35 | 35 |
36 /** Atomic compare and set, for pointers. | |
37 * If *addr == before, set *addr to after. Always returns previous value of *a
ddr. | |
38 * This must act as a compiler barrier. | |
39 */ | |
40 static void* sk_atomic_cas(void** addr, void* before, void* after); | |
41 | |
42 /** If sk_atomic_dec does not act as an acquire (L/SL) barrier, | 36 /** If sk_atomic_dec does not act as an acquire (L/SL) barrier, |
43 * this must act as an acquire (L/SL) memory barrier and as a compiler barrier. | 37 * this must act as an acquire (L/SL) memory barrier and as a compiler barrier. |
44 */ | 38 */ |
45 static void sk_membar_acquire__after_atomic_dec(); | 39 static void sk_membar_acquire__after_atomic_dec(); |
46 | 40 |
47 /** If sk_atomic_conditional_inc does not act as an acquire (L/SL) barrier, | 41 /** If sk_atomic_conditional_inc does not act as an acquire (L/SL) barrier, |
48 * this must act as an acquire (L/SL) memory barrier and as a compiler barrier. | 42 * this must act as an acquire (L/SL) memory barrier and as a compiler barrier. |
49 */ | 43 */ |
50 static void sk_membar_acquire__after_atomic_conditional_inc(); | 44 static void sk_membar_acquire__after_atomic_conditional_inc(); |
51 | 45 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 fMutex = NULL; | 108 fMutex = NULL; |
115 } | 109 } |
116 } | 110 } |
117 | 111 |
118 private: | 112 private: |
119 SkBaseMutex* fMutex; | 113 SkBaseMutex* fMutex; |
120 }; | 114 }; |
121 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) | 115 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) |
122 | 116 |
123 #endif | 117 #endif |
OLD | NEW |