Since prior to the enhancement, it was possible to create scenarios where the false branch was never taken due to the atomic load falling inside the same superblock as the CAS that depends on it, I should have a simple unit test that asserts that after X minutes it ends up failing.
atomic_int x = ATOMIC_VAR_INIT(0);
atomic_bool running = ATOMIC_VAR_INIT(true);
#pragma omp parallel
while (running) {
int y = atomic_load(&x);
assert(atomic_compare_exchange_strong(&x, &y, y + 1));
}
The above should not fail with the old translation but should fail with the new.
Since prior to the enhancement, it was possible to create scenarios where the false branch was never taken due to the atomic load falling inside the same superblock as the CAS that depends on it, I should have a simple unit test that asserts that after X minutes it ends up failing.
The above should not fail with the old translation but should fail with the new.