[Qt-interest] QMutex deadlock without using QMutex

michael.goddard at nokia.com michael.goddard at nokia.com
Thu Apr 29 06:16:43 CEST 2010


> My question is what are good debugging tools to get this kind 
> of information?
> Obviously this is platform dependent, but for the sake of 
> argument, what tools
> are available (and how best do you use them) on linux / gcc 
> and/or windows / vs
> and/or windows / mingw?

One good tool under Linux/MacOSX is helgrind (part of valgrind - http://valgrind.org, or more specifically http://valgrind.org/docs/manual/hg-manual.html).  

Aside from that, you can write wrapper classes that store the thread associated with any locked mutexes, and follow the graph to detect cycles (deadlocks) when you're trying to lock a mutex.  Doesn't help so much in this case, since it's apparently not your code calling QMutex. (QMutex will detect self-deadlocks of a non-recursive mutex and print a warning, but not mutex lock cycles).

Cheers,
MichaelG



More information about the Qt-interest-old mailing list