Re:MutexProtected: A C++ Pattern for Easier Concurrency
by MontagFTB on Thursday April 06, 2023 @09:03AM
(#35467805)
Holding the reference to a field that is protected by a mutex implies there is another thread out there that will race with your reference in either reading or writing it.
Even just a read is racy, as there is no “atomic read” of any size value if it is not already wrapped as atomic.
Even just a read is racy, as there is no “atomic read” of any size value if it is not already wrapped as atomic.