Quantcast
Channel: why use std::atomic if it still requires a mutex to work properly - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by eerorika for why use std::atomic if it still requires a mutex to...

why use std::atomic if [condition variable] still requires a mutex to work properlyThere is no reason to use an atomic condition variable.What is the use for atomicsEven if atomics aren't useful for...

View Article



Answer by paddy for why use std::atomic if it still requires a mutex to work...

The semantics of a conditional wait necessitates the use of a mutex.This is because there is a potential race condition on the thread that is testing the condition. When this thread is checking whether...

View Article

why use std::atomic if it still requires a mutex to work properly

Reading the text for std::condition_variable I've come across this sentence:Even if the shared variable is atomic, it must be modified under the mutex in order to correctly publish the modification to...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images