38 lines
973 B
C++
38 lines
973 B
C++
#ifndef THREADBASE_H
|
|
#define THREADBASE_H
|
|
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#include <iostream>
|
|
|
|
class ThreadBase
|
|
{
|
|
public:
|
|
ThreadBase(void);
|
|
virtual ~ThreadBase();
|
|
virtual void ThreadBase_ThreadLoopFunc(int tInputFlag, void *pInputArg) = 0;
|
|
// virtual void ThreadBase_ThreadLoopFunc(int tInputFlag, void *pInputArg) {}
|
|
static void *ThreadBase_ThreadLoopDistribute(void *pInputArg);
|
|
void ThreadBase_ThreadJoin(void);
|
|
int ThreadBase_ThreadCreate(void);
|
|
int ThreadBase_ThreadCreate(void *pInputArg);
|
|
int ThreadBase_ThreadCreate(int tInputFlag, void *pInputArg);
|
|
int ThreadBase_ThreadCreateWithPrio(int tInputPrio);
|
|
|
|
private:
|
|
struct ThreadParam
|
|
{
|
|
pthread_t m_tThreadID_;
|
|
void *m_pInstance_;
|
|
int m_tFlag_;
|
|
void *m_pArg_;
|
|
};
|
|
pthread_t m_tThreadPid_;
|
|
|
|
int ThreadBase_InterCreateThread(int tInputPrio, int tInputFlag, void *pInputArg);
|
|
|
|
protected:
|
|
int p_tThreadCnt;
|
|
};
|
|
|
|
#endif |