Boost logo

Boost Users :

From: Jason Winnebeck (yg-boost-users_at_[hidden])
Date: 2003-07-31 17:09:42


Mark Sizer wrote:

> Generically, the difference between critical sections and mutexes is
> immense. In terms of implementation, one never knows.
>
> A critical section blocks EVERYTHING else in the process. A mutex only
> blocks things that are waiting on that particular mutex.

Are you absolutely serious/sure about that? I've been using critical
sections becauase I couldn't find a reason to use mutexes. So far I've
only run my program on single processor machines (where it probably
doesn't matter), but I'd hate to think I would have a huge amount of
contention on multiprocessor machines.

I can see how crit secs can be faster on a single CPU machine with those
semantics, because when you schedule the process, you just decide to
only schedule that thread. And on a single CPU just setting a flag
should work and be safe to do.

Jason


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net