You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
#ifndef __BASICDUALTHREAD_H_INCL__
|
|
#define __BASICDUALTHREAD_H_INCL__
|
|
|
|
#include "basicThread.h"
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author Gagua
|
|
*/
|
|
class basicDualThread {
|
|
private:
|
|
basicLogCollection *m_pLog;
|
|
#if defined( __linux__ ) || defined(WIN_PTHREAD)
|
|
pthread_t m_sThreadAHandler;
|
|
static void *m_fThreadAEntryPoint(void *);
|
|
pthread_t m_sThreadBHandler;
|
|
static void *m_fThreadBEntryPoint(void *);
|
|
#else
|
|
HANDLE m_hThreadAHandle;
|
|
HANDLE m_hThreadBHandle;
|
|
DWORD m_dwThreadAID;
|
|
DWORD m_dwThreadBID;
|
|
static DWORD WINAPI m_fThreadAEntryPoint( LPVOID lpParameter );
|
|
static DWORD WINAPI m_fThreadBEntryPoint( LPVOID lpParameter );
|
|
#endif
|
|
protected:
|
|
thredStatus m_bThreadAStatus;
|
|
virtual void m_fThreadAProc( void );
|
|
|
|
thredStatus m_bThreadBStatus;
|
|
virtual void m_fThreadBProc( void );
|
|
public:
|
|
// Constructor
|
|
basicDualThread();
|
|
|
|
// Destructor
|
|
~basicDualThread();
|
|
|
|
virtual bool init( void );
|
|
virtual bool uninit( void );
|
|
thredStatus getAStatus( void ){ return m_bThreadAStatus; };
|
|
thredStatus getBStatus(void){ return m_bThreadBStatus; };
|
|
void waitThreadAEnd( bool Force = true );
|
|
void waitThreadBEnd( bool Force = true );
|
|
};
|
|
|
|
// Constructor implementation
|
|
inline basicDualThread::basicDualThread(){
|
|
m_pLog = basicLogCollection::getInstance();
|
|
m_bThreadAStatus = TH_PRE_INIT;
|
|
m_bThreadBStatus = TH_PRE_INIT;
|
|
};
|
|
|
|
// Destructor implementation
|
|
inline basicDualThread::~basicDualThread(){
|
|
waitThreadAEnd( true );
|
|
waitThreadBEnd( true );
|
|
};
|
|
|
|
|
|
#endif // __BASICTHREAD_H_INCL__
|