2013-11-26 21:51:40 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by [Dennis Andersen] [2013]
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-11-26 21:08:34 +01:00
|
|
|
#ifndef MISC_OYSTER_THREAD_H
|
|
|
|
#define MISC_OYSTER_THREAD_H
|
|
|
|
|
|
|
|
#include "IThreadObject.h"
|
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Thread
|
|
|
|
{
|
|
|
|
enum OYSTER_THREAD_ERROR
|
|
|
|
{
|
|
|
|
OYSTER_THREAD_ERROR_FAILED,
|
|
|
|
OYSTER_THREAD_ERROR_SUCCESS,
|
|
|
|
};
|
2013-12-13 23:47:16 +01:00
|
|
|
enum OYSTER_THREAD_PRIORITY
|
|
|
|
{
|
|
|
|
OYSTER_THREAD_PRIORITY_1, //!< High
|
|
|
|
OYSTER_THREAD_PRIORITY_2, //!< Medium
|
|
|
|
OYSTER_THREAD_PRIORITY_3, //!< Low
|
|
|
|
};
|
2013-11-26 21:08:34 +01:00
|
|
|
|
|
|
|
class OysterThread
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
struct PrivateData;
|
|
|
|
PrivateData *privateData;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OysterThread();
|
2013-11-27 21:47:32 +01:00
|
|
|
OysterThread(const OysterThread& original);
|
|
|
|
const OysterThread& operator=(const OysterThread& original);
|
2013-11-26 21:08:34 +01:00
|
|
|
virtual~OysterThread();
|
|
|
|
|
|
|
|
OYSTER_THREAD_ERROR Create(IThreadObject* worker, bool start);
|
|
|
|
OYSTER_THREAD_ERROR Start();
|
2013-12-13 23:47:16 +01:00
|
|
|
void Stop(bool wait = false);
|
2013-11-26 21:08:34 +01:00
|
|
|
void Pause();
|
|
|
|
void Pause(int mSec);
|
|
|
|
void Resume();
|
|
|
|
OYSTER_THREAD_ERROR Reset(IThreadObject* worker = 0);
|
2013-12-13 23:47:16 +01:00
|
|
|
void Terminate(bool wait = false);
|
2013-11-26 21:08:34 +01:00
|
|
|
void Wait();
|
|
|
|
void Wait(int mSec);
|
|
|
|
OYSTER_THREAD_ERROR Swap(const OysterThread* other);
|
|
|
|
bool IsActive();
|
2013-12-13 23:47:16 +01:00
|
|
|
void SetPriority(OYSTER_THREAD_PRIORITY priority);
|
2013-11-26 21:08:34 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-26 21:51:40 +01:00
|
|
|
#endif // !MISC_OYSTER_THREAD_H
|