20 #if defined(__LINUX__) 21 void* threadFunction(
void* pvThread)
30 void threadFunction(
void* pvThread)
38 unsigned int __stdcall threadFunction(
void* pvThread)
53 m_uiStackSize(1228000),
56 m_bThreadRunFlag(false),
57 m_bThreadStopFlag(false),
59 m_pfuThreadFunction(0)
65 error(-1,
"copy contructor : method should no be called!");
70 debug(1,
"destructed");
81 error(-1,
"assignment operator : method should not be called!");
120 unsigned int iThreadId;
122 m_hThreadHandle = (HANDLE)_beginthreadex(NULL, 0, threadFunction, (
void*)
this, 0, &iThreadId);
124 if(m_hThreadHandle == NULL)
126 warning(
"createThread : creating thread failed!");
136 #if defined(__LINUX__) 137 pthread_attr_t Thread_attr;
139 int retVal = pthread_create(&m_hThreadHandle, NULL, threadFunction, (
void*)
this);
142 warning(
"createThread : creating thread failed!");
160 warning(
"createThread : creating stack failed!");
168 warning(
"createThread : creating thread failed!");
CThread & operator=(const CThread &clThread)
int createThread(void(*fuThreadFunction)(CThread *), void *pThreadObject)
void error(const int iErrorCode, const char *pcErrorMessage,...) const
void setThreadStackSize(unsigned int uiSize)
void exitThread()
called inside the thread function before leaving the thread
void terminateThread()
called outside the thread function to terminate the thread
unsigned int m_uiStackSize
void warning(const char *pcWarningMessage,...) const
bool checkThreadRun()
check outside the thread function to check running
void debug(const int iDebugLevel, const char *pcDebugMessage,...) const
bool checkThreadStop()
check inside the thread function to check termination
void(* m_pfuThreadFunction)(CThread *)