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 SkOnce_DEFINED | 8 #ifndef SkOnce_DEFINED |
9 #define SkOnce_DEFINED | 9 #define SkOnce_DEFINED |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 release_barrier(); | 117 release_barrier(); |
118 *done = true; | 118 *done = true; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 // We nabbed this code from the dynamic_annotations library, and in their honor | 122 // We nabbed this code from the dynamic_annotations library, and in their honor |
123 // we check the same define. If you find yourself wanting more than just | 123 // we check the same define. If you find yourself wanting more than just |
124 // ANNOTATE_BENIGN_RACE, it might make sense to pull that in as a dependency | 124 // ANNOTATE_BENIGN_RACE, it might make sense to pull that in as a dependency |
125 // rather than continue to reproduce it here. | 125 // rather than continue to reproduce it here. |
126 | 126 |
127 #ifdef DYNAMIC_ANNOTATIONS_ENABLED | 127 #if DYNAMIC_ANNOTATIONS_ENABLED |
128 // TSAN provides this hook to supress a known-safe apparent race. | 128 // TSAN provides this hook to supress a known-safe apparent race. |
129 extern "C" { | 129 extern "C" { |
130 void AnnotateBenignRace(const char* file, int line, const volatile void* mem, co
nst char* desc); | 130 void AnnotateBenignRace(const char* file, int line, const volatile void* mem, co
nst char* desc); |
131 } | 131 } |
132 #define ANNOTATE_BENIGN_RACE(mem, desc) AnnotateBenignRace(__FILE__, __LINE__, m
em, desc) | 132 #define ANNOTATE_BENIGN_RACE(mem, desc) AnnotateBenignRace(__FILE__, __LINE__, m
em, desc) |
133 #else | 133 #else |
134 #define ANNOTATE_BENIGN_RACE(mem, desc) | 134 #define ANNOTATE_BENIGN_RACE(mem, desc) |
135 #endif | 135 #endif |
136 | 136 |
137 // This is our fast path, called all the time. We do really want it to be inlin
ed. | 137 // This is our fast path, called all the time. We do really want it to be inlin
ed. |
(...skipping 13 matching lines...) Expand all Loading... |
151 // The release barrier in sk_once_slow guaranteed that *done = true | 151 // The release barrier in sk_once_slow guaranteed that *done = true |
152 // happens after once(arg), so by syncing to *done = true here we're | 152 // happens after once(arg), so by syncing to *done = true here we're |
153 // forcing ourselves to also wait until the effects of once(arg) are readble
. | 153 // forcing ourselves to also wait until the effects of once(arg) are readble
. |
154 acquire_barrier(); | 154 acquire_barrier(); |
155 } | 155 } |
156 | 156 |
157 #undef ANNOTATE_BENIGN_RACE | 157 #undef ANNOTATE_BENIGN_RACE |
158 | 158 |
159 | 159 |
160 #endif // SkOnce_DEFINED | 160 #endif // SkOnce_DEFINED |
OLD | NEW |