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

Function CASDecrementThread

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

Source from the content-addressed store, hash-verified

132
133template<typename T>
134static void CASDecrementThread(int64_t id, int64_t n, AtomicInt<T>* ai) {
135 T oldval = 0;
136 T newval = 0;
137 bool success = false;
138 for (int64_t i = 0; i < n * id; ++i) {
139 success = false;
140 while (!success) {
141 oldval = ai->Load();
142 newval = oldval - 1;
143 success = ai->CompareAndSwap(oldval, newval);
144 }
145 }
146}
147
148template<typename T>
149static void TestMultipleThreadsCASIncDec() {

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.45
CompareAndSwapMethod · 0.45

Tested by

no test coverage detected