Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

c++ - Boost Mutex implementation for Windows

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...