OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkThread.h" | 8 #include "SkThread.h" |
9 #include "SkTLS.h" | 9 #include "SkTLS.h" |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 SkAutoMutexAcquire ac(gAtomicMutex); | 103 SkAutoMutexAcquire ac(gAtomicMutex); |
104 | 104 |
105 int32_t value = *addr; | 105 int32_t value = *addr; |
106 if (value != 0) ++*addr; | 106 if (value != 0) ++*addr; |
107 return value; | 107 return value; |
108 } | 108 } |
109 void sk_membar_aquire__after_atomic_conditional_inc() { } | 109 void sk_membar_aquire__after_atomic_conditional_inc() { } |
110 | 110 |
111 #endif | 111 #endif |
112 | 112 |
| 113 int32_t sk_atomic_unprotected_read(const volatile int32_t & x) { |
| 114 return x; |
| 115 } |
| 116 |
113 #endif // SK_BUILD_FOR_ANDROID | 117 #endif // SK_BUILD_FOR_ANDROID |
114 | 118 |
115 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
116 | 120 |
117 static void print_pthread_error(int status) { | 121 static void print_pthread_error(int status) { |
118 switch (status) { | 122 switch (status) { |
119 case 0: // success | 123 case 0: // success |
120 break; | 124 break; |
121 case EINVAL: | 125 case EINVAL: |
122 SkDebugf("pthread error [%d] EINVAL\n", status); | 126 SkDebugf("pthread error [%d] EINVAL\n", status); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // and just return NULL if we've never been called with | 215 // and just return NULL if we've never been called with |
212 // forceCreateTheSlot==true ? | 216 // forceCreateTheSlot==true ? |
213 | 217 |
214 (void)pthread_once(&gSkTLSKey_Once, sk_tls_make_key); | 218 (void)pthread_once(&gSkTLSKey_Once, sk_tls_make_key); |
215 return pthread_getspecific(gSkTLSKey); | 219 return pthread_getspecific(gSkTLSKey); |
216 } | 220 } |
217 | 221 |
218 void SkTLS::PlatformSetSpecific(void* ptr) { | 222 void SkTLS::PlatformSetSpecific(void* ptr) { |
219 (void)pthread_setspecific(gSkTLSKey, ptr); | 223 (void)pthread_setspecific(gSkTLSKey, ptr); |
220 } | 224 } |
OLD | NEW |