DerivedThread.h
上传用户:jnsxzc
上传日期:2007-01-03
资源大小:25k
文件大小:1k
源码类别:

进程与线程

开发平台:

Visual C++

  1. // DerivedThread.h: interface for the CDerivedThread class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_DERIVEDTHREAD_H__65C44177_9AA3_11D3_8D3F_00105AAA7BB6__INCLUDED_)
  5. #define AFX_DERIVEDTHREAD_H__65C44177_9AA3_11D3_8D3F_00105AAA7BB6__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "Thread.h"
  10. #include "RWLock.h" // Added by ClassView
  11. typedef struct threadArgumentTag {
  12. CListBox * pListBox;
  13. CRWLock  * pRwLock;
  14. bool       bReader;
  15. }threadArgument, *pThreadArgument;
  16. class CDerivedThread : public CThread  
  17. {
  18. public:
  19. CDerivedThread(void * pArg=NULL) 
  20. pThreadArgument pArgStruct = (pThreadArgument)pArg;
  21. m_pcListBox =  (CListBox *)pArgStruct->pListBox;
  22. m_pcLock = (CRWLock *)pArgStruct->pRwLock;
  23. m_bReader = (bool)pArgStruct->bReader;
  24. }
  25. virtual ~CDerivedThread() {}
  26. static char g_szStringToUpdate[128];
  27. static int g_nWriteLockAccesses;
  28. static int g_nReadLockAccesses;
  29. protected:
  30. void run();
  31. private:
  32. CDerivedThread(const CDerivedThread&);
  33. operator=(const CDerivedThread&);
  34. CListBox * m_pcListBox;
  35. CRWLock *  m_pcLock;
  36. bool       m_bReader;
  37. };
  38. #endif // !defined(AFX_DERIVEDTHREAD_H__65C44177_9AA3_11D3_8D3F_00105AAA7BB6__INCLUDED_)