4

I have a scenario where multiple threads are writing to a common buffer (a map), each thread could or could not have the same key. Can someone please advise on whether i should use boost::shared_mutex or just boost::mutex? My understanding is that boost::shared_mutex is for a single writer and multiple reads which is not what i want. Does this make boost::mutex more appropriate for this scenario?

thanks in advance

4

1 回答 1

5

是的,boost::shared_mutex这不是你的情况,因为你没有纯粹的读者并且有多个作家。仅用于boost::mutex强制对共享数据进行独占访问。

于 2013-08-23T20:53:28.997 回答