Boost :: shared_mutex vs boost :: mutex for writing multiple threads?

I have a scenario where several threads are written to a shared buffer (card), each thread may or may not have the same key. Can someone please advise whether to use boost :: shared_mutex or just boost :: mutex? I understand that boost :: shared_mutex is for one writer and several readings, which are not what I want. Does this make boost :: mutex more suitable for this scenario?

early

+4
source share
1 answer

Yes, boost::shared_mutex not your case, since you do not have clean readers and you have many writers. Just use boost::mutex to provide exclusive access to shared data.

+5
source

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


All Articles