Read lock over shared mutex

We will get a shared lock if we put the std::shared_timed_mutex into a std::unique_lock. I think the unique_lock acquires a write lock. as shared_lock acquires a read lock. Please correct me if I am wrong

When you put a std::shared_timed_mutex into a std::shared_lock, you get a shared lock. When you a std::sharded_timed_mutex into a std::lock_guard, you get a exclusive lock. Consequentially, the lock (shared_lock versus lock_guard) decides, if you get a shared of an exclusive lock.

1 Like