Mixed practice for the atomics unit. Each update must be one atomic step, so decide from the value the operation returns, and loop on compare_exchange_weak when no single operation fits. The tests run on one thread; rules on your code check that each update is atomic.