MCPcopy Create free account
hub / github.com/apache/impala / AcquireReleaseThreadA

Function AcquireReleaseThreadA

be/src/common/atomic-test.cc:183–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182template<typename T>
183static void AcquireReleaseThreadA(T id, T other_id, int iters, AtomicInt<T>* control,
184 T* payload) {
185 const int DELAY = 100;
186 for (int it = 0; it < iters; ++it) {
187 // Phase 1
188 // (A-1) This store is not allowed to reorder with the below "store release".
189 *payload = it;
190 control->Store(other_id);
191
192 // Phase 2
193 while (control->Load() != id) ;
194 // (A-2) This store is not allowed to reorder with the above "load acquire".
195 *payload = -it;
196
197 // Give thread B a chance to get started on Phase 1.
198 for (int i = 0; i < DELAY; ++i) {
199 AtomicUtil::CompilerBarrier();
200 }
201 }
202}
203
204template<typename T>
205static void AcquireReleaseThreadB(T id, T other_id, int iters, AtomicInt<T>* control,

Callers

nothing calls this directly

Calls 2

StoreMethod · 0.45
LoadMethod · 0.45

Tested by

no test coverage detected