I am currently using openMP to write code running on multicore nodes. openMP has a specific memory model that guarantees memory synchronization between threads running on different cores when a lock is received.
I am considering using C ++ 11 constructs ( std::threadwith std::mutexand std::lock) instead of openMP (because of their greater flexibility), and I wonder if memory synchronization between processors is guaranteed here? And if not, how can I enforce it?
std::thread
std::mutex
std::lock
std::mutex, 30.4.1.2 [thread.mutex.requirements.mutex]/6-25
m.lock(): () .
m.lock()
: () .
, ,
m.unlock(): , .
m.unlock()
: , .
( " " - , $1.10, , ++ Concurrency In Action)