Boost logo

Threads-Devel :

From: Anthony Williams (anthony_at_[hidden])
Date: 2006-04-11 05:34:20

I was reading an article in MSDN Magazine about preventing deadlocks in .NET

and I thought it would be useful to provide similar mechanisms in boost.

We could use TSS to store the current lock level for each thread, and only
allow mutexes to be locked if they had a higher lock level than the current
lock level for that thread.

We could also write a checked mutex that kept track of which thread owned
which mutex, and which thread was waiting on which mutex. Every time a thread
blocked on a mutex, it could check the owner of that mutex to see if they were
waiting on a mutex, and if they were, which mutex. The chain could then be
followed until we either get a loop, which would imply deadlock, or find a
thread which is not waiting.

Does anyone think these ideas are worth pursuing?


Anthony Williams
Software Developer
Just Software Solutions Ltd

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at