BOOST:递归shared_mutex? [英] BOOST: recursive shared_mutex?

查看:279
本文介绍了BOOST:递归shared_mutex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎Boost的shared_mutex是非递归的..有没有反正呢? (无需重新实现整个内容)

Seems that Boost's shared_mutex is non recursive.. Is there anyway around this? (without re implementing the whole stuff)

推荐答案

查看此线程和此优秀的解释为什么 shared_mutex 是一个坏主意。所以如果你不同意 recursive_mutex 也是不错的主意,只是使用它没有任何锐度,因为它不能给你任何性能提升。

have a look at this thread and this excellent explanation why shared_mutex is bad idea in general. so if you don't agree that recursive_mutex is bad idea too, just use it without any shariness because it cannot give you any performance boost. you'll receive even a bit cleaner code w/o any major changes.

我试图在我的项目中使用shared_mutex锁定高竞争的地图,当许多线程经常读取数据时并很少修改它。收到了较差的性能结果

I tried to use shared_mutex in my project to lock highly contested map when many threads often reads data and rarely modify it. received a bit worse performance results

这篇关于BOOST:递归shared_mutex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆