|
Boost : |
From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-08-15 06:20:08
>To explain why we need plain Mutex a a concept I'll take a little step
>back... The purpose of a concept is to describe the requirements
>placed on a template argument by a template function or class. Now a
>template function or class is more reusable the more abstract, or the
>fewer the requirements on the template arguments. I call this the
>"requirement minimization principal". Anotherwords, a template
>function should always pick the minimal concept that "covers" the
>function's requirements. Now it is easy to think of situations where a
>particular template function would need a Mutex and not a
>ConditionVariable, say to protect access to a global variable. For
>this template function we need a concept to describe the
>requirements. The right choice is Mutex and not MutexWithCV because of
>the minimization principal.
Agreed, another point here; if we want a condition-variable, then the mutex
becomes "the thing that supports the condition-variable", not an end in
itself, therefore having the mutex type a nested member of the
condition-variable makes some sense.
- John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk