[Interest] Write from different thread

R. Reucher rene.reucher at batcom-it.net
Thu Aug 23 09:51:43 CEST 2012


On Thursday 23 August 2012 09:39:38 R. Reucher wrote:
> On Thursday 23 August 2012 08:27:02 Igor Mironchik wrote:
> > Is it safe to write in to the QTCPSocket from the different threads if
> > socket is protected with mutex?
> 
> Weel, as the docs state, QTcpSocket is reentrant, which does NOT imply it's
> thread-safe... however, that has nothing to do with the use of mutex'es.
Oops, guess I was a bit too quick with my answer, misinterpreting a statement 
from the docs. So, as long as you take care of the serialization (with 
mutex'es), it should work. However, is it really useful? I mean, wouldn't it 
be better to have a thread for each socket/connection, utilizing its own data 
(so you don't have to care about thread synchronization)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120823/ff65d1af/attachment.html>


More information about the Interest mailing list