home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / advanced / mutexes / threads.h < prev   
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.6 KB  |  106 lines

  1. // threads.h : header file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. //
  13. // This sample application is derived from the Mutex application
  14. // distributed with Jeffrey Richter's "Advanced Windows" programming book
  15. // (Microsoft Press).  See the book for more information about Win32
  16. // programming topics, including thread synchronization.
  17.  
  18. class CMutexesDlg;
  19.  
  20. class CExampleThread : public CWinThread
  21. {
  22.     DECLARE_DYNCREATE(CExampleThread)
  23. protected:
  24.     CExampleThread();
  25.  
  26. public:
  27.     CMutexesDlg* m_pOwner;
  28.     BOOL m_bDone;
  29.     void SetOwner(CMutexesDlg* pOwner) { m_pOwner = pOwner; };
  30. };
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CCounterThread thread
  34.  
  35. class CCounterThread : public CExampleThread
  36. {
  37.     DECLARE_DYNCREATE(CCounterThread)
  38. protected:
  39.     CCounterThread();           // protected constructor used by dynamic creation
  40.  
  41. // Attributes
  42. public:
  43.  
  44. // Operations
  45. public:
  46.  
  47. // Overrides
  48.     // ClassWizard generated virtual function overrides
  49.     //{{AFX_VIRTUAL(CCounterThread)
  50.     public:
  51.     virtual BOOL InitInstance();
  52.     virtual int Run();
  53.     //}}AFX_VIRTUAL
  54.  
  55. // Implementation
  56. public:
  57.     virtual ~CCounterThread();
  58.  
  59.     // Generated message map functions
  60.     //{{AFX_MSG(CCounterThread)
  61.         // NOTE - the ClassWizard will add and remove member functions here.
  62.     //}}AFX_MSG
  63.  
  64.     DECLARE_MESSAGE_MAP()
  65. };
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68.  
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CDisplayThread thread
  72.  
  73. class CDisplayThread : public CExampleThread
  74. {
  75.     DECLARE_DYNCREATE(CDisplayThread)
  76. protected:
  77.     CDisplayThread();           // protected constructor used by dynamic creation
  78.  
  79. // Attributes
  80. public:
  81.  
  82. // Operations
  83. public:
  84.  
  85. // Overrides
  86.     // ClassWizard generated virtual function overrides
  87.     //{{AFX_VIRTUAL(CDisplayThread)
  88.     public:
  89.     virtual BOOL InitInstance();
  90.     virtual int Run();
  91.     //}}AFX_VIRTUAL
  92.  
  93. // Implementation
  94. public:
  95.     virtual ~CDisplayThread();
  96.  
  97.     // Generated message map functions
  98.     //{{AFX_MSG(CDisplayThread)
  99.         // NOTE - the ClassWizard will add and remove member functions here.
  100.     //}}AFX_MSG
  101.  
  102.     DECLARE_MESSAGE_MAP()
  103. };
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106.