OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
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 | 8 |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 18 matching lines...) Expand all Loading... | |
29 static_cast<LONG>(inc)); | 29 static_cast<LONG>(inc)); |
30 } | 30 } |
31 | 31 |
32 int32_t sk_atomic_dec(int32_t* addr) { | 32 int32_t sk_atomic_dec(int32_t* addr) { |
33 return _InterlockedDecrement(reinterpret_cast<LONG*>(addr)) + 1; | 33 return _InterlockedDecrement(reinterpret_cast<LONG*>(addr)) + 1; |
34 } | 34 } |
35 void sk_membar_aquire__after_atomic_dec() { } | 35 void sk_membar_aquire__after_atomic_dec() { } |
36 | 36 |
37 int32_t sk_atomic_conditional_inc(int32_t* addr) { | 37 int32_t sk_atomic_conditional_inc(int32_t* addr) { |
38 while (true) { | 38 while (true) { |
39 LONG value = static_cast<LONG const volatile&>(*addr); | 39 volatile LONG value = *addr; |
caryclark
2013/06/19 14:23:07
This change isn't equivalent. This makes the L-val
| |
40 if (value == 0) { | 40 if (value == 0) { |
41 return 0; | 41 return 0; |
42 } | 42 } |
43 if (_InterlockedCompareExchange(reinterpret_cast<LONG*>(addr), | 43 if (_InterlockedCompareExchange(reinterpret_cast<LONG*>(addr), |
44 value + 1, | 44 value + 1, |
45 value) == value) { | 45 value) == value) { |
46 return value; | 46 return value; |
47 } | 47 } |
48 } | 48 } |
49 } | 49 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 #pragma const_seg() | 127 #pragma const_seg() |
128 | 128 |
129 #else | 129 #else |
130 | 130 |
131 #pragma data_seg(".CRT$XLB") | 131 #pragma data_seg(".CRT$XLB") |
132 PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback; | 132 PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback; |
133 #pragma data_seg() | 133 #pragma data_seg() |
134 | 134 |
135 #endif | 135 #endif |
136 } | 136 } |
OLD | NEW |