|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2004-07-22 12:20:30
From: Howard Hinnant <hinnant_at_[hidden]>
>
> Oh, I just remembered another reason I chose defer_lock over deferred.
> I was trying to be symmetric with the try-counterpart:
>
> scoped_lock lk1(m, defer_lock);
> scoped_lock lk2(m, try_lock);
>
> vs:
>
> scoped_lock lk1(m, deferred);
> scoped_lock lk2(m, tried);
>
> <shrug> I disliked "tried" more than I liked "deferred". And I also
> felt that the benefit of symmetry was important to make the interface
> easier to learn.
Actually, I think "deferred" and "tried" are better. The reason
is that they say that locking of a lock so constructed was
"deferred" or "tried." The latter doesn't indicate whether the
attempt to lock succeeded, just that there was an attempt.
From: Michael Glassford <glassfordm_at_[hidden]>
>
> Another possibility is to name the second parameter as an adjective
> describing the initial state of the lock instead of a verb:
>
> scoped_lock l(m, unlocked);
This, seems even better; it's at least easier to explain!
scoped_lock lk1(m, unlocked);
scoped_lock lk2(m, tried);
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk