[Qt-interest] QMutex deadlock without using QMutex
Andre Somers
andre at familiesomers.nl
Wed Apr 28 09:47:41 CEST 2010
Hi Tony,
On 28-4-2010 2:20, Tony Rietwyk wrote:
> -----Original Message-----
>>
>> 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. (...)
>>
>> Still, I get this error in my output:
>> QMutex::lock: Deadlock detected in thread<some number>
>> (...)
>>
>>
> Hi André,
>
> Are you connecting to slots on the thread objects themselves (bad), or to
> objects created in the thread's run method (good)? Check the thread
> affinities of the objects you are connecting to. You might find some that
> are the same, which means Qt will not queue the signals, but call direct.
This has been taken care of, but it is a valid concern. All the worker
objects are running into their own threads and have the correct thread
affinity.
> Also when the manager thread gets a worker finished signal, instead of
> signalling the response immediately, try a single-shot timer with 0 delay.
> That way, the first signal has completely finished, when you send the
> response signal.
>
>
I tried it, but if anything, it causes the deadlock to occur sooner in
the calculation.
Thanks for the suggestions though.
André
More information about the Qt-interest-old
mailing list