[Qt-interest] how to debug a deadlock

Atlant Schmidt aschmidt at dekaresearch.com
Wed Jul 14 13:51:48 CEST 2010


Matthias:

  You might consider creating a thread whose sole function
  is to manage a queue of messages to be sent to the DLL.
  It would be designed to accept messages from all of your
  other threads and do the correct serialization of them
  before sending the messages onwards to the DLL.

  That should avoid mutexes entirely.

                        Atlant

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Matthias Pospiech
Sent: Wednesday, July 14, 2010 7:29 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] how to debug a deadlock

I have a dll sending commands using the serial port. The dll is from a
company and I can only use it the way it is.
My problem is that this dll does not synchronise commands and replies
over the serial port.
This becomes a problem if I send commands from different threads.

The simplest solution would be to ensure that all commands can only be
called once at the same time.
So that the next command must wait for the previous to be finished. Here
however is not difference between setting and getting
(or reading and writing), because the dll always sends and recieves for
a single command.

Now my idea was to use a
QMutexLocker  locker( &mutex );

in every function sending commands with the dll.

This however leads to an immediate deadlock. QtCreator however does not
show where this deadlock happend.
Now I wonder how to debug this?

Matthias


This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.




More information about the Qt-interest-old mailing list