[Interest] QMutex and QTimer timeout

Rainer Wiesenfarth Rainer_Wiesenfarth at trimble.com
Tue Oct 7 06:10:45 CEST 2014


Am 06.10.2014 22:23, schrieb Francisco Ares:
> I'm trying to implement a serial communication class.  Under certain
> conditions, I would like to send a message, then keep the thread locked
> until some specific answer arrives, then the thread could be unlocked.
>
> While testing the connection, the lock (using a QMutex for this) may
> lock forever if the connection is opened, so I have implemented a single
> shot QTimer so that the thread could have an exit point when this timer
> period times out.
>
> But it does not work.
>
> The QMutex and the QTimer are on the same thread.  Does QMutex locks the
> thread so much?  Any advice?

For what I can tell based on your information, QWaitCondition might help 
you.

If not, you might have to give us some source code of what you are 
trying to do.

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4255 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141007/f9aee05f/attachment.bin>


More information about the Interest mailing list