| 117 | |
| 118 | template<typename T> |
| 119 | static 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 | |
| 133 | template<typename T> |
| 134 | static void CASDecrementThread(int64_t id, int64_t n, AtomicInt<T>* ai) { |
nothing calls this directly
no test coverage detected