33 lines
657 B
C++
33 lines
657 B
C++
#ifndef HYDRATHREAD
|
|
#define HYDRATHREAD
|
|
|
|
#include "../engine/HydraObject.h"
|
|
#include <thread>
|
|
#include <string>
|
|
#include <mutex>
|
|
#include <condition_variable>
|
|
|
|
class CLASS_DEFINE HydraThread : public HydraObject
|
|
{
|
|
private:
|
|
std::thread m_thread;
|
|
bool m_running = false;
|
|
|
|
protected:
|
|
virtual void Initialise() {};
|
|
virtual void Process();
|
|
public:
|
|
std::string ThreadName = "";
|
|
std::mutex ThreadLock;
|
|
std::condition_variable WaitCondition;
|
|
std::thread::id ThreadID;
|
|
HydraThreadAffinity ThreadAffinity = HydraThreadAffinity::General;
|
|
void RunLoop();
|
|
void Start();
|
|
void Stop();
|
|
|
|
|
|
};
|
|
|
|
#endif /* HYDRATHREAD */
|