Std :: mutex создает забор?
Если я заблокирую
std::mutex я всегда получу забор памяти? Я не уверен, если это подразумевает или заставляет вас получить забор.
Нашел эту ссылку после комментариев RMF.
Ответы на вопрос(2)
Как я понимаю, это кроется в:
1.10 Multi-threaded executions and data races
The library deﬁnes a number of atomic operations (Clause 29) and operations on mutexes (Clause 30) that are specially identiﬁed as synchronization operations. These operations play a special role in making assignments in one thread visible to another. A synchronization operation on one or more memory locations is either a consume operation, an acquire operation, a release operation, or both an acquire and release operation. A synchronization operation without an associated memory location is a fence and can be either an acquire fence, a release fence, or both an acquire and release fence. In addition, there are relaxed atomic operations, which are not synchronization operations, and atomic read-modify-write operations, which have special characteristics. [Note: For example, a call that acquires a mutex will perform an acquire operation on the locations comprising the mutex. Correspondingly, a call that releases the same mutex will perform a release operation on those same locations. Informally, performing a release operation on A forces prior side eﬀects on other memory locations to become visible to other threads that later perform a consume or an acquire operation on A. “Relaxed” atomic operations are not synchronization operations even though, like synchronization operations, they cannot contribute to data races. —end note]