On quinta-feira, 23 de agosto de 2012 11.36.16, Marc Mutz wrote:
> 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.

On the spot.

QMutex-protecting an object doesn't make sense. You need to block the entire
thread from executing.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to