Qtopia Home · Index · Classes · Headers · Overviews

QDThread Class Reference

The QDThread class extends QThread to include basic synchronization with the calling thread. More...

    #include <QDThread>

Inherits QThread.

Public Functions

Additional Inherited Members

Detailed Description

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.

Member Function Documentation

QDThread::QDThread ( QObject * parent = 0 )

Construct a QDThread instance with parent.

QDThread::~QDThread ()   [virtual]


void QDThread::init ()

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.

void QDThread::start ()

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.

void QDThread::t_init ()   [virtual]

On-thread initialization. Objects that need to live in the new thread should be constructed here.

void QDThread::t_quit ()   [virtual]

On-thread cleanup. Objects created in t_init() should be destroyed here. This is called immediatley after t_run() returns.

void QDThread::t_run ()   [virtual]

This is the main run method. The thread is stopped when this method finishes. The default implementation calls QThread::exec().

Copyright © 2008 Nokia Qtopia Sync Agent Documentation