[Interest] QThreads: There's no one way to "do it right"! :)
Jason H
scorp1us at yahoo.com
Wed Jan 23 17:44:32 CET 2013
Generally, I never need more than the fundamental types so signals/slots work.
You also have to be careful of your database and database driver. Not all are multi-thread friendly, and Qt may impose additional constraints.
________________________________
From: Mandeep Sandhu <mandeepsandhu.chd at gmail.com>
To: "Interest at qt-project.org" <interest at qt-project.org>
Sent: Wednesday, January 23, 2013 2:42 AM
Subject: [Interest] QThreads: There's no one way to "do it right"! :)
First I thought "I was doing it right"
Then they said "you're doing it wrong"
(http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/)
Then I thought "I _finally_ got it right"!!
Now they say "You were not doing so wrong"
(http://woboq.com/blog/qthread-you-were-not-doing-so-wrong.html)!! :D
End of my Cute poem! :P
Jokes apart, which method do most ppl here prefer when doing threading?
Clearly, if done carefully, both methods work as intented.
My rule of thumb is that, if you're doing a simple but compute
intensive task where you don't want communication via signal/slots
(probably thats what the author of the last post meant by not needing
event loop), go with subclassing QThread.
However, if your worker is a little more complex, where you need to
maintain state across runs, do signal/slot comm etc, then it's better
to go with a 'moveToThread()' approach.
Regards,
-mandeep
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130123/e61475ef/attachment.html>
More information about the Interest
mailing list