Boost logo

Threads-Devel :

From: Anthony Williams (anthony_at_[hidden])
Date: 2007-01-30 06:08:13


"Josh Napoli" <jnapoli_at_[hidden]> writes:

> Has there been any work on a checked_mutex class? I have a prototype
> mutex class that tracks the order in which locks were acquired. If a
> lock would violate the partial ordering defined by the historical lock
> acquisitions, then it throws an exception rather than risking deadlock.
> Does this sound correct and useful?

That's an interesting approach. In the past, I've written one prototype that
enforce a declared order, by assigning a "level" to each mutex, and only
allowing locking mutexes with higher "level" numbers than the current one, and
another prototype of a fully-checked mutex that actually follows the
which-thread-is-waiting chain to detect deadlocks; it hadn't occurred to me to
build the partial ordering at runtime.

Anthony

-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk