
18 May
2011
18 May
'11
3:45 p.m.
On 05/18/2011 12:17 AM, Phil Bouchard wrote:
The bottom line is I would need a ~mutex() that discards errors and an atomic way of performing the following consecutive locks:
template <typename V> block_ptr & operator = (block_ptr<V> const & p) { mutex::scoped_lock scoped_lock1(ps_->redir()->mutex_); mutex::scoped_lock scoped_lock2(p.ps_->redir()->mutex_);
... }
Combining the locking of multiple mutexes requires defining an order in which they should always be acquired so as to define a lock hierarchy. Using the address of the mutex in question for that ordering should work.