问题描述
据我所知,在旧版本的 Boost boost::mutex 中,Windows 的实现是使用临界区完成的.但是在 Boost 1.51 的最新版本中,我发现现在互斥锁的实现是基于事件的.
As far as I know in old versions of Boost boost::mutex implementation for Windows was done using critical sections. But in the newest version of Boost 1.51 I discovered that now mutex implementation is based on Events.
有人知道这种变化背后的原因是什么吗?是因为性能原因吗?临界区会被弃用吗?
Does anybody know what is the rational behind this change? Was it done because of performance reasons? Do critical sections become deprecated?
推荐答案
通过使用 boost,我们总是有最好的方法而不做任何改变,这不是很好吗?在新版本的 boost 中,boost::mutex 被实现为一个自旋锁,但在 Windows 事件的帮助下避免忙等待,并且该事件只会在需要时创建,因此它非常轻量级并且具有非常高的性能并且还使 boost 能够使用这个轻量级的 mutex 进行定时等待!我觉得这个很棒
Isn't it wonderful that by using boost we always have best approach with no change?
In new version of boost, boost::mutex is implemented as an spinlock but with the help of a windows event to avoid busy wait and that event will only created if needed, thus it is very light weight and have a very high performance and also enable boost to use this light weight mutex for timed wait! I think this is excellent
这篇关于Windows 的 Boost Mutex 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)