Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
common/perf_counters: fix race condition with atomic variables #14227
Please check my logic for this apparent fix. This technique of using two matched atomic variables as a guard against race conditions is new to me.
Fix potential race condition. With the old code it would be possible
==inc== ==read_avg== avgcount.inc() avgcount.read() A) u64.read() u64.add() B) u64.read() avgcount2.inc() avgcount2.read()
Depending on whether u64.read() is called at A) or B) we'd get the new
Signed-off-by: J. Eric Ivancich firstname.lastname@example.org