14 #ifndef hifi_GenericThread_h
15 #define hifi_GenericThread_h
17 #include <QtCore/QObject>
31 void initialize(
bool isThreaded =
true, QThread::Priority priority = QThread::NormalPriority);
36 virtual void terminating() { };
38 bool isThreaded()
const {
return _isThreaded; }
42 virtual void setup() {};
43 virtual void shutdown() {};
56 void lock() { _mutex.lock(); }
61 bool isStillRunning()
const {
return !_stopThread; }
Definition: GenericThread.h:23
void initialize(bool isThreaded=true, QThread::Priority priority=QThread::NormalPriority)
Definition: GenericThread.cpp:33
virtual bool process()=0
Override this function to do whatever your class actually does, return false to exit thread early.
void lock()
Locks all the resources of the thread.
Definition: GenericThread.h:56
void unlock()
Unlocks all the resources of the thread.
Definition: GenericThread.h:59
void terminate()
Call to stop the thread.
Definition: GenericThread.cpp:59
void threadRoutine()
If you're running in non-threaded mode, you must call this regularly.
Definition: GenericThread.cpp:75