On 1/2/2026 1:05 PM, Chris M. Thomasson wrote:
Sometimes we do not need to make per variable membars. For instance the atomic logic for locking/unlocking a mutex can all be relaxed. BUT, we
need to add in the right membars, so it tends to go like this: ___________________
atomic_mutex_lock(); // all relaxed
ÿÿ std::atomic_thread_fence(std::memory_order_acquire);
ÿÿÿÿ {
ÿÿÿÿÿÿÿÿ // critical section...
ÿÿÿÿ }
ÿÿ std::atomic_thread_fence(std::memory_order_release); atomic_mutex_unlock(); // all relaxed
___________________
Its more of a SPARC way of thinking about where to place memory barriers.
Some atomic lock algos need to have a damn #StoreLoad in the logic
itself. Ala, Dekker's algorithm.
--- PyGate Linux v1.5.2
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)