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

Function CASIncrementThread

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

Source from the content-addressed store, hash-verified

117
118template<typename T>
119static void CASIncrementThread(int64_t id, int64_t n, AtomicInt<T>* ai) {
120 T oldval = 0;
121 T newval = 0;
122 bool success = false;
123 for (int64_t i = 0; i < n * id; ++i) {
124 success = false;
125 while (!success) {
126 oldval = ai->Load();
127 newval = oldval + 1;
128 success = ai->CompareAndSwap(oldval, newval);
129 }
130 }
131}
132
133template<typename T>
134static void CASDecrementThread(int64_t id, int64_t n, AtomicInt<T>* ai) {

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.45
CompareAndSwapMethod · 0.45

Tested by

no test coverage detected