[Qt-interest] Best practices for a thread object

Etienne Sandré-Chardonnal etienne.sandre at polytechnique.org
Sun Jan 16 19:56:53 CET 2011


Thanks from the beginner. Have we met before?

The 4.7.1 docs says "To create your own threads, subclass QThread and
reimplement run <http://doc.qt.nokia.com/latest/qthread.html#run>()".
Apparently (since the first post I have read many debates on the topic)
subclassing is definitely not the method recommended by the qt
developpers... Thus, the doc needs refreshing.


Second question to the constructive people : what about threads that will do
nothing but pure blocking computations in a loop? The approach described
above is based on the event loop. Would you still keep that approach and put
the blocking computations in a slot? There is no real sense to start an
event loop in that case.
For the non-blocking threads that do some I/O for instance, I like that
non-subclassing approach, thanks.

Regards,

Etienne






2011/1/16 Arnold Krille <arnold at arnoldarts.de>

> On Sunday 16 January 2011 17:23:20 Etienne Sandré-Chardonnal wrote:
> > Thanks to both, I understand the new approach.
> >
> > The QT doc definitely needs to be refreshed regarding QThreads...
>
> Actually the docs about QThread and multi-threading and QtConcurrent are
> very
> good since quite some years (since the public release of these
> classes/modules). Its users of these classes not reading and understanding
> the
> docs. And that you can't fix with writing more documentation...
>
> BTW: There is also a reason why the QThread docs state that you should read
> additional documentation about threads and stuff. The Qt docs are not meant
> as
> a complete beginners guide to programming, they are there to help you use
> Qt.
>
> Have fun,
>
> Arnold
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110116/7ef36998/attachment.html 


More information about the Qt-interest-old mailing list