问题描述
据我所知,在旧版本的Boost对于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.
有谁知道这是什么变化背后的理性?是不是因为性能的原因呢?不要临界区成为德precated?
Does anybody know what is the rational behind this change? Was it done because of performance reasons? Do critical sections become deprecated?
推荐答案
这不是很美妙,通过使用升压
我们总是有没有变化最好的方法?
在新版本的升压
,的boost ::互斥
实现为自旋锁但与Windows事件的帮助避免忙等待和事件只创建如果需要的,因此,它重量很轻,有一个非常高的性能,也使升压
来使用这个重量轻互斥
的定时的等待!我认为这是极好的。
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!