|
Boost : |
From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-12-08 09:55:33
Yuval Ronen wrote:
> I will gladly put my code here to be scrutinized by the experts on this
> forum (after the weekend, as the code is at work, and I'm at home now
> :-) ), but I fear that they will little incentive to do it.
Can't tell. Possibly yes. You will need to try.
> Ok, I'm afraid I didn't explain myself properly. Apologies for that.
> What I mentioned only briefly, and had to emphasize more, is that the
> call to notify() will check to see if the mutex is locked - the mutex
> that was passed in the ctor, and throw an exception if not. The wait()
> function does it already, except that it should be changed to check the
> stored mutex&.
>
> I hope this explanation helps answering your questions above.
If it is only about protecting the user from as you say "bad usage",
where is the problem? If you need this behavior you easily can write a
little convenience-wrapper for your projects that achieves this goal.
The threading library is designed to allow you the broadest valid usage,
only protecting from agreed misuses. Why should we unnecessarily limit
the libraries API when you can specialize it to your needs?
And even if you might find out that there is a way on windows where your
proposed change allows for a faster implementation, you still would need
to prove that this also holds for other operating systems.
Roland
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk