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.
78 lines
2.0 KiB
78 lines
2.0 KiB
#ifndef __BASICDUALTHREAD_H_INCL__
|
|
#define __BASICDUALTHREAD_H_INCL__
|
|
|
|
#include "basicThread.h"
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author Gagua
|
|
*/
|
|
class basicDualThread {
|
|
private:
|
|
THREAD_HANDLE_TYPE m_hThreadAHandle;
|
|
THREAD_HANDLE_TYPE m_hThreadBHandle;
|
|
#ifdef WIN_THREAD
|
|
DWORD m_dwThreadAID;
|
|
DWORD m_dwThreadBID;
|
|
#endif
|
|
static THREAD_EXECUT_PROC m_fThreadAEntryPoint( THREAD_PARAM_TYPE lpParameter );
|
|
static THREAD_EXECUT_PROC m_fThreadBEntryPoint( THREAD_PARAM_TYPE lpParameter );
|
|
protected:
|
|
thredStatus m_bThreadAStatus;
|
|
virtual void m_fThreadAProc( void );
|
|
|
|
thredStatus m_bThreadBStatus;
|
|
virtual void m_fThreadBProc( void );
|
|
basicLogCollection *m_pLog;
|
|
|
|
public:
|
|
// Constructor
|
|
basicDualThread();
|
|
|
|
// Destructor
|
|
~basicDualThread();
|
|
|
|
virtual bool init( 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(){
|
|
if( m_bThreadAStatus > TH_ARMED ) {
|
|
waitThreadAEnd();
|
|
};
|
|
if( m_bThreadBStatus > TH_ARMED ) {
|
|
waitThreadBEnd();
|
|
};
|
|
};
|
|
|
|
// TODO: Uncomment the copy constructor when you need it.
|
|
//inline basicThread::basicThread(const basicThread& src)
|
|
//{
|
|
// // TODO: copy
|
|
//}
|
|
|
|
// TODO: Uncomment the assignment operator when you need it.
|
|
//inline basicThread& basicThread::operator=(const basicThread& rhs)
|
|
//{
|
|
// if (this == &rhs) {
|
|
// return *this;
|
|
// }
|
|
//
|
|
// // TODO: assignment
|
|
//
|
|
// return *this;
|
|
//}
|
|
|
|
#endif // __BASICTHREAD_H_INCL__
|