Qt Extended Home · Index · Classes · Headers · Overviews |
The QDThread class extends QThread to include basic synchronization with the calling thread. More...
#include <QDThread>
Inherits QThread.
The QDThread class extends QThread to include basic synchronization with the calling thread.
QThread does not provide synchronization with the calling thread. The problem is that some objects need to be created on the new thread (due to Qt's threading rules) but need access to information that is not available until the thread is actually running. Another example is needing to do some on-thread setup before the calling thread continues.
QDThread allows this by providing 2 methods to start the thread. init() brings the thread up and start() allows it to continue running. The t_init() function is called on-thread before init() returns. The t_run() function is called on the thread after start() is called. The t_quit() function is called after t_run() returns.
Construct a QDThread instance with parent.
Destructor.
Bring up the thread. This causes t_init() to be called on the new thread. The init() function will not return until t_init() has completed.
Start the thread. This causes t_run() to be called on the new thread. If the thread has not been created init() will be called to bring it up.
On-thread initialization. Objects that need to live in the new thread should be constructed here.
On-thread cleanup. Objects created in t_init() should be destroyed here. This is called immediatley after t_run() returns.
This is the main run method. The thread is stopped when this method finishes. The default implementation calls QThread::exec().
Copyright © 2009 Trolltech | Qt Extended Sync Agent Documentation |