WorkerThread Class Reference

the supporting thread in order to run operations on a different thread instead of the GUI thread More...

List of all members.

Signals

void exceptionDuringOperation (BaseException *e)
 The signal emitted when a ThreadOperation throws as exception.

Public Member Functions

 WorkerThread (QObject *parent)
 constructor
 ~WorkerThread ()
 destructor
void addOperation (ThreadOperation *operation)
 Add an operation to the queue.
void quit ()
 stop the current operation and quit from the thread terminating its cycle.
void run ()
 implement the main run routine
void stopCurrentOperation ()
 Stop the current operation.

Detailed Description

the supporting thread in order to run operations on a different thread instead of the GUI thread

Definition at line 126 of file workerthread.h.


Constructor & Destructor Documentation

WorkerThread ( QObject *  parent)

constructor

Definition at line 27 of file workerthread.cpp.

destructor

Definition at line 37 of file workerthread.cpp.


Member Function Documentation

void addOperation ( ThreadOperation operation)

Add an operation to the queue.

Definition at line 43 of file workerthread.cpp.

void exceptionDuringOperation ( BaseException *  e) [signal]

The signal emitted when a ThreadOperation throws as exception.

This signal is emitted when a ThreadOperation object throws an exception and terminates. The exception is cloned (or an instance of UnknownException is created) and stored here. We keep the list of all exceptions ever thrown to avoid problems (with the current implementation we don't know when it is safe to deleted the cloned object)

Parameters:
ea clone of the exception thrown in the ThreadOperation
Note:
The connection to this signal must be of type Qt::QueuedConnection or Qt::BlockingQueuedConnection because the signal is emitted from another thread. This should be fixed (use a QObject with the correct thread affinity)

Referenced by WorkerThread::run().

void quit ( )

stop the current operation and quit from the thread terminating its cycle.

Note:
this is the safe way to close the thread
Warning:
this is a blocking method

Definition at line 104 of file workerthread.cpp.

References WorkerThread::stopCurrentOperation().

void run ( )

implement the main run routine

Definition at line 61 of file workerthread.cpp.

References WorkerThread::exceptionDuringOperation(), and ThreadOperation::run().

void stopCurrentOperation ( )

Stop the current operation.

Definition at line 53 of file workerthread.cpp.

References ThreadOperation::stop().

Referenced by WorkerThread::quit().


The documentation for this class was generated from the following files: