Sometimes I have to write code like this: timed_mutex mtx;
void foo() { { xtime xt = get_it(); timed_mutex::scoped_timed_lock lock1(mtx, xt); if(lock1) { // ... } } { boost::xtime xt = get_it(); timed_mutex::scoped_timed_lock lock2(mtx, xt); if(lock2) { // ... } } } I don't like extra scope needed to control locking. IMO, ScopeGuard idiom can be used to get rid of it. In example below class "lock" plays the role of ScopeGuard: void foo() { xtime xt = get_it(); if(lock lock1 = timed_mutex::scoped_timed_lock(mtx, xt)) { // ... } xt = get_it(); if(lock lock2 = timed_mutex::scoped_timed_lock(mtx, xt)) { // ... } } -- Alexander Nasonov Remove minus and all between minus and at from my e-mail for timely response _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost