[Interest] Write from different thread

Marc Mutz marc.mutz at kdab.com
Thu Aug 23 11:36:16 CEST 2012


On Thursday August 23 2012, Thiago Macieira wrote:
> On quinta-feira, 23 de agosto de 2012 09.27.02, Igor Mironchik wrote:
> > Hello.
> >
> > Is it safe to write in to the QTCPSocket from the different threads if
> > socket is protected with mutex?
>
> No.

To expand on this:

QTcpSocket is-a QIODevice which is-a QObject, and no QObject can be protected 
by a mutex, since it performs implicit event handling which would be very 
complex to mutex-protect.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions



More information about the Interest mailing list