We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0db2492 + ea87a07 commit 2b19329Copy full SHA for 2b19329
benchmarks/lockhammer/include/atomics.h
@@ -494,8 +494,8 @@ void synchronize_threads(uint64_t *barrier, unsigned long nthrds)
494
uint64_t tmp_sense = ~global_sense & SENSE_BIT_MASK;
495
uint32_t local_sense = (uint32_t)(tmp_sense >> 32);
496
497
- fetchadd64_acquire(barrier, 2);
498
- if (*barrier == ((nthrds * 2) | global_sense)) {
+ uint64_t old_barrier = fetchadd64_acquire(barrier, 2);
+ if (old_barrier == (((nthrds - 1) * 2) | global_sense)) {
499
// Make sure the store gets observed by the system. Reset count
500
// to zero and flip the sense bit.
501
__atomic_store_n(barrier, tmp_sense, __ATOMIC_RELEASE);
0 commit comments