Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-08-25 13:12:05


Howard Hinnant:

> Adding the condition(Mutex&) constructor which does nothing but
> specify undefined behavior provides no benefit, and quite possibly
> adds cost to valid use cases of condition which use the default
> constructor instead.

I disagree with both statements, even when taken individually. Together,
they obviously contradict one another.

The mutex constructor MAY provide no benefit (except portability and the
potential to do a designated checked build) if the implementation chooses to
ignore it, in which case there is no cost. I would expect this to be the
case on embedded or realtime platforms.

The mutex constructor MAY add cost to the constructor that takes no mutex,
in which case it does provide benefit since the cost presumably comes from
the checking logic.

It MAY even provide benefit at a cost that is acceptable to the target
audience. See "checked release" and vary the number 17041 according to
taste.

In contrast, if you make it impossible for the user to explicitly associate
a mutex with the condition, the implementation MAY NOT check, even if it can
somehow do that for free (it knows about an unused void* in the
pthread_cond_t, for example).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk