#include <thread_template.h>
Public Member Functions | |
Thread_Template (QObject *p) | |
Create a new thread object. | |
~Thread_Template () | |
Stop the thread and delete the thread object. | |
ThreadClass * | item () |
Access the threaded object. | |
bool | waitForStarted () |
wait till the thread is started and the object is created. | |
Private Member Functions | |
void | run () |
Private Attributes | |
ThreadClass * | _item |
This runs whatever object you have in its own thread. Its basicly the same as inheriting from QThread but easier to apply to objects since there is no need for a new class. So you can use your classes in threaded and non-threaded environments without introducing new classes or changing existing ones.
The object of the thread is created at the start of run(), then a QEventLoop is running and when the thread gets stopped the object is deleted.
Also if you delete the thread-object itself the eventloop is stopped and the threaded object deleted.
NSCore::Thread_Template< ThreadClass >::Thread_Template | ( | QObject * | p | ) | [inline] |
Create a new thread object.
NSCore::Thread_Template< ThreadClass >::~Thread_Template | ( | ) | [inline] |
Stop the thread and delete the thread object.
References NSCore::Thread_Template< ThreadClass >::_item.
ThreadClass* NSCore::Thread_Template< ThreadClass >::item | ( | ) | [inline] |
Access the threaded object.
References NSCore::Thread_Template< ThreadClass >::_item.
Referenced by EMEAWindow::objectInNewThread().
bool NSCore::Thread_Template< ThreadClass >::waitForStarted | ( | ) | [inline] |
wait till the thread is started and the object is created.
References NSCore::Thread_Template< ThreadClass >::_item.
Referenced by EMEAWindow::objectInNewThread().
void NSCore::Thread_Template< ThreadClass >::run | ( | ) | [inline, private] |
References NSCore::Thread_Template< ThreadClass >::_item.
ThreadClass* NSCore::Thread_Template< ThreadClass >::_item [private] |