[Qt-interest] QMutex deadlock without using QMutex

Sean Harmer sean.harmer at maps-technology.com
Tue Apr 27 16:50:12 CEST 2010


Hi André,

On Tuesday 27 April 2010 15:31:33 Andre Somers wrote:
> Hi,
> 
> I am running into a weird problem.
> For running calculations on a large dataset, I split up the work over a
> number of threads. I use signals and slots to communicate between the
> worker threads and a coordinator thread, and also between that
> coordinator thread and the rest of the application. I do not use any
> explicit thread synchronisation methods like QMutex in that part of the
> application.

You say from that *part* of the application. Are you sure that the error 
message is coming from this part of your application?

> Still, I get this error in my output:
> QMutex::lock: Deadlock detected in thread <some number>

Can you reproduce this in a small example that uses just your data processing 
threads? 

Have a grep through the Qt source to find where that message is printed and 
then set a break point there to see where in your code it is being triggered 
from.

> What could this mean? Are there other causes conceivable for this
> happening? Is there behind-the-scenes locking/unlocking of mutexes that
> Qt is doing when performing signalling between threads?

I am not sure but I do not think so. However, I think that Qt does use worker 
threads in a couple of other places such as QFileSystemWatcher (on some 
platforms only I think) and in QFileSystemModel. Not sure if these make use of 
mutexes internally or not though.

Good luck,

Sean




More information about the Qt-interest-old mailing list