the supporting thread in order to run operations on a different thread instead of the GUI thread More...
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, bool deleteAtEnd=true) |
Add an operation to the queue. | |
bool | operationRunning () |
Returns true if an operation is running. | |
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.
~WorkerThread | ( | ) |
destructor
Definition at line 37 of file workerthread.cpp.
Member Function Documentation
void addOperation | ( | ThreadOperation * | operation, |
bool | deleteAtEnd = true |
||
) |
Add an operation to the queue.
If deleteAtEnd is true the operation is deleted when it has finished executing, otherwise it is not
Definition at line 43 of file workerthread.cpp.
|
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
-
e a 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().
bool operationRunning | ( | ) |
Returns true if an operation is running.
Definition at line 115 of file workerthread.cpp.
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 106 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().
void stopCurrentOperation | ( | ) |
Stop the current operation.
Definition at line 53 of file workerthread.cpp.
Referenced by WorkerThread::quit().
The documentation for this class was generated from the following files:
- utilities/include/workerthread.h
- utilities/src/workerthread.cpp