Does `std :: mutex` and` std :: lock` support memory synchronization in interprocessor code?

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?

+5
source share
1 answer

std::mutex, 30.4.1.2 [thread.mutex.requirements.mutex]/6-25

m.lock()

: () .

, ,

m.unlock()

: , .

( " " - , $1.10, , ++ Concurrency In Action)

+9

All Articles