do you have any info about the subject? any problem with boost::shared_mutex in particular and with reader-writer mutexes at all?
reader-writer mutex can be misused, e.g. frequent writer locks reduces performance, even in comparison with simple mutex. but there're a lot of cases when many readers often require a shared resource that can be modified by writer really infrequently.
Anthony Williams is an influential member of the C++ standards committee. He co-authored many of the proposals that led to the inclusion of the thread library in the C++11 Standard. You can read his objections in this commentary. Nevertheless, it did make it into C++17.
As told in the mail referenced by Hans, the problem with shared_mutex
is its high overhead. Therefore shared_mutex
gives only a benefit when resources are held for a long time and only few threads are competing for the resources, which is very rare.
I found another detailed article about the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With