
On Tuesday 29 June 2004 8:00 am, Christopher Currie wrote:
The basic usages (covering about 80%) are:
scoped_lock l(m); // Block until it locks. scoped_try_lock l(m); // Try (!) to lock. I'll check the result.
I disagree here, as well. Say I want to program generically...
template <typename Mutex, typename Lock> class worker_class { Mutex m_;
public: do_work() { Lock l(m_); // Does this call block? // am I guarenteed to be locked here? } }
Yes, it's a contrived case,
I don't believe it is a contrived case. Certainly once we have read/write mutexes we're going to want to tell generic components which kind of lock they need to use.
but the point is that all locks should have the same behavior in the 1-argument constructor case, and that is to block until this lock is obtained. The is the only way the user can use the lock in a generic way.
Absolutely. This is *extremely* important to keep in mind when discussing any kind of concept taxonomy. Refinements of a concept can only add restrictions, they cannot remove them. Doug