Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-08-22 10:32:13

on Tue Aug 21 2007, "Peter Dimov" <> wrote:

> In general, I don't like designs that mandate checking by specifying
> behavior on error because they make incorrect programs correct. That is, it
> is no longer possible for the library to loudly flag invalid uses as the
> client may exploit the documented behavior and expect (or worse, ignore) the
> exception.

Thank you for making my favorite argument.

> It also requires that the library catches 100% of the errors,
> rather than 99.4% of them, and these last 0.6% can be expensive.
> There could be legitimate use cases that require the exception.

Huh. You're saying that there could be cases in which it's not a
programming error to use a different mutex with the condition
variable? Like, somehow, the same cv is used with different mutexes
during different periods of execution, but always used simultaneously
by different threads with the same mutex?

> If forced, I would probably supply checked_condition to address this
> need, if it proves justified.

I guess, since condition isn't movable, that need is conceivable.

> Or I might not, as checked_condition seems trivial to write as a
> wrapper over condition (unless I'm missing something - I haven't
> actually prototyped the code).

Good point.

Dave Abrahams
Boost Consulting
The Astoria Seminar ==>

Boost list run by bdawes at, gregod at, cpdaniel at, john at