|
Threads-Devel : |
Subject: [Threads-devel] hierarchical_mutex for lock hierarchies (to avoid deadlocks)
From: Fredrik Orderud (forderud_at_[hidden])
Date: 2013-02-17 16:32:52
I've registered a Trac "feature request" for a "hierarchical" mutex to
facilitate lock hierarchies [1] in boost. Lock hierarchies is a construct
that associates mutexes with software layer numbers, and enforces the
application to only lock "downwards" in the software hierarchy [2]. This
effectively translates potential deadlocks into deterministic run-time
failures that can more easily be detected during testing.
An example draft implementation is attached to the issue. The attachment
also includes a BOOST_THREAD_LOCAL work-around for missing "thread_local"
support that should probably be moved to more neutral ground
Please let me know if there are any questions regarding the usefulness of
hierarchical_mutex, or comments on the implementation, and I'll do my best
to assist.
Regards,
Fredrik Orderud
[1] https://svn.boost.org/trac/boost/ticket/8094
[2]
http://www.drdobbs.com/parallel/use-lock-hierarchies-to-avoid-deadlock/204801163