Guest User

Untitled

a guest
Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. RS232Timer::RS232Timer()
  2. {
  3. m_hThreadEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
  4. m_hThreadControlEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
  5. m_bThreadActive = false;
  6. m_bRunThread = false;
  7. }
  8.  
  9. void RS232Timer::startThread()
  10. {
  11. m_bRunThread = true;
  12. (void)ResetEvent(m_hThreadEvent);
  13. (void)ResetEvent(m_hThreadControlEvent);
  14. (void)AfxBeginThread(timeoutThread,(void*)this); //timeoutThread is another function
  15. if((waitForSingleObject(m_hThreadControlEvent,1500)!=WAIT_OBJECT_O)||!m_bThreadActive)
  16. {
  17. assert(FALSE);
  18. m_bThread = false;
  19. }
  20. }
Add Comment
Please, Sign In to add comment