2012-06-14 09:06:06 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class cThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef void (ThreadFunc)(void*);
|
2014-07-21 09:19:48 -04:00
|
|
|
cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_ThreadName = 0);
|
2012-06-14 09:06:06 -04:00
|
|
|
~cThread();
|
|
|
|
|
2014-07-21 09:19:48 -04:00
|
|
|
void Start( bool a_bWaitOnDelete = true);
|
2012-06-14 09:06:06 -04:00
|
|
|
void WaitForThread();
|
|
|
|
private:
|
|
|
|
ThreadFunc* m_ThreadFunction;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2014-07-21 09:19:48 -04:00
|
|
|
static unsigned long MyThread(void* a_Param);
|
2012-06-14 09:06:06 -04:00
|
|
|
#else
|
2014-07-21 09:19:48 -04:00
|
|
|
static void *MyThread( void *lpParam);
|
2012-06-14 09:06:06 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void* m_Param;
|
|
|
|
cEvent* m_Event;
|
|
|
|
cEvent* m_StopEvent;
|
|
|
|
|
2012-07-15 16:32:50 -04:00
|
|
|
AString m_ThreadName;
|
2014-03-25 12:33:52 -04:00
|
|
|
};
|