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

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASICDUALTHREAD_H_INCL__
  2. #define __BASICDUALTHREAD_H_INCL__
  3. #include "basicThread.h"
  4. /**
  5. * TODO: Add class description
  6. *
  7. * @author Gagua
  8. */
  9. class basicDualThread {
  10. private:
  11. THREAD_HANDLE_TYPE m_hThreadAHandle;
  12. THREAD_HANDLE_TYPE m_hThreadBHandle;
  13. #ifdef WIN_THREAD
  14. DWORD m_dwThreadAID;
  15. DWORD m_dwThreadBID;
  16. #endif
  17. static THREAD_EXECUT_PROC m_fThreadAEntryPoint( THREAD_PARAM_TYPE lpParameter );
  18. static THREAD_EXECUT_PROC m_fThreadBEntryPoint( THREAD_PARAM_TYPE lpParameter );
  19. protected:
  20. thredStatus m_bThreadAStatus;
  21. virtual void m_fThreadAProc( void );
  22. thredStatus m_bThreadBStatus;
  23. virtual void m_fThreadBProc( void );
  24. basicLogCollection *m_pLog;
  25. public:
  26. // Constructor
  27. basicDualThread();
  28. // Destructor
  29. ~basicDualThread();
  30. virtual bool init( void );
  31. thredStatus getAStatus( void ){ return m_bThreadAStatus; };
  32. thredStatus getBStatus(void){ return m_bThreadBStatus; };
  33. void waitThreadAEnd( bool Force = true );
  34. void waitThreadBEnd( bool Force = true );
  35. };
  36. // Constructor implementation
  37. inline basicDualThread::basicDualThread(){
  38. m_pLog = basicLogCollection::getInstance();
  39. m_bThreadAStatus = TH_PRE_INIT;
  40. m_bThreadBStatus = TH_PRE_INIT;
  41. };
  42. // Destructor implementation
  43. inline basicDualThread::~basicDualThread(){
  44. if( m_bThreadAStatus > TH_ARMED ) {
  45. waitThreadAEnd();
  46. };
  47. if( m_bThreadBStatus > TH_ARMED ) {
  48. waitThreadBEnd();
  49. };
  50. };
  51. // TODO: Uncomment the copy constructor when you need it.
  52. //inline basicThread::basicThread(const basicThread& src)
  53. //{
  54. // // TODO: copy
  55. //}
  56. // TODO: Uncomment the assignment operator when you need it.
  57. //inline basicThread& basicThread::operator=(const basicThread& rhs)
  58. //{
  59. // if (this == &rhs) {
  60. // return *this;
  61. // }
  62. //
  63. // // TODO: assignment
  64. //
  65. // return *this;
  66. //}
  67. #endif // __BASICTHREAD_H_INCL__