cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
What is the difference between unique_lo
What is the difference between unique_lock and shared-lock?
Mar 11, 2019 at 9:55pm UTC
JUAN DENT
(326)
As far as I can tell, only one unique_lock can be associated with a mutex, while several shared_locks can be associated with a common mutex. Why is this useful? Can someone provide an example?
When to use one or the other?
Regards,
Juan Dent
Mar 11, 2019 at 11:22pm UTC
keskiverto
(10402)
Apparently to allow simultaneous (shared) read access.
Writers must use exclusive access.
https://stackoverflow.com/questions/46049803/difference-between-shared-mutex-and-mutex-why-do-both-exist-in-c-11
https://en.cppreference.com/w/cpp/thread/shared_mutex
Topic archived. No new replies allowed.