When to use Mutex C ++ 11, lock, unique_lock, shared_lock, etc.

  • What is the difference between shared_lock and shared_mutex.lock_shared (), except that the shared_lock destructor unlocks the associated mutex?
  • Is shared_mutex the only mutex class that I can use with shared_lock?
  • Why does anyone want to use lock_guard instead of unique_lock?
  • If I have many threads that constantly block reading (shared_lock) of a variable, and I have a variable that tries to lock it for writing (unique_lock), will this message flow take precedence over others?
  • Is there a chance for a dead end for # 4?
+4
source share

Source: https://habr.com/ru/post/1616299/


All Articles