3 ms·
Your reasoning is correct. Also, if it makes you sleep better :-), here's the boost implementation of a spinlock: https://github.com/boostorg/sync/blob/dfdf317
by spacechild1 5y ago
Your reasoning is correct. Also, if it makes you sleep better :-), here's the boost implementation of a spinlock:
https://github.com/boostorg/sync/blob/dfdf317f63d26fb40c703b8d2dc6bbf99c5ca1db/include/boost/sync/detail/mutexes/spin_mutex.hpp#L69 https://github.com/boostorg/sync/blob/dfdf317f63d26fb40c703b...
It has been written by an expert in lockfree programming (Tim Blechmann)
- albertzeyer 5y agoI wonder, there was this change/fix: https://github.com/boostorg/sync/commit/1b5aaa4a0b7ef4fad2a46336a201081740e1c624#diff-3808384c88a5623a406c6b8073b76294dba88f784b17da9e3316d75295fcde6a https://github.com/boostorg/sync/commit/1b5aaa4a0b7ef4fad2a4...
- spacechild1 5y agoThe title "Corrected memory order in some cases" is a bit misleading because the original code was correct. The commit just relaxes some unnecessarily strict memory orderings (to improve performance on platforms with weak memory models). BTW, the spinlock implementation is not affected.