[Interest] QtConcurrent and event-driven objects
Bo Thorsen
bo at vikingsoft.eu
Tue Jan 27 09:28:05 CET 2015
On 01/26/2015 11:56 AM, Dmitriy Purgin wrote:
> Another important thing for me is network. The docs also specify that
> the network module should also follow single thread policy. Does that
> mean that an instance of QTcpSocket can't be used in QRunnable started
> by QThreadPool?
You can only use the socket in one thread at a time. You can pass it on
to another thread, but you will find yourself with weird bugs if you do
this a lot.
You haven't given enough information to say if this is a problem for you
or not. If the threads just send stuff over the socket, then implement
this with simple message parsing to the thread that have the socket. If
the threads handle incoming messages (which I wouldn't expect, since
you're using timers instead of handling incoming data signals), the
answer depends on whether your protocol allows out of sync answers or not.
Bo Thorsen,
Director, Viking Software.
--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
More information about the Interest
mailing list