From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-10 09:04:44
> --- In boost_at_y..., flameframe_at_h... wrote:
> > http://world.std.com/~jmhart/csmutx.htm.
> This was the article that someone pointed me to. The conclusion was
> that CS are only faster if:
> * There are less than 8 threads total in the process.
> * You weren't running in the background.
> * You weren't on an dual processor machine.
The code in the article tested a fairly pathological case; the threads were
always competing for the same critical section, and spent no time outside,
i.e. they immediately tried to reacquire. So the conclusion is more like
* There are, at any moment, less than 8 threads waiting on the same CS.
This is an interesting data point, but I don't think that it's a killer
argument against CS use.
A common usage of boost::mutex would be making a library thread safe. If
such a library is accessed from a single thread (fairly common even in
multithreaded programs) using a win32 mutex would impose a significant
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk