Source code of Windows XP (NT5)
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.

129 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1990-1994 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. ThreadM.hxx
  6. Abstract:
  7. Generic thread manager header.
  8. Author:
  9. Albert Ting (AlbertT) 13-Feb-1994
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. Albert Ting (AlbertT) 27-May-1994 C++ized
  14. --*/
  15. #ifndef _THREADM_HXX
  16. #define _THREADM_HXX
  17. typedef PVOID PJOB;
  18. class TThreadM {
  19. friend TDebugExt;
  20. friend DWORD xTMThreadProc( LPVOID pVoid );
  21. SIGNATURE( 'thdm' )
  22. SAFE_NEW
  23. private:
  24. enum _States {
  25. kDestroyReq = 1,
  26. kDestroyed = 2,
  27. kPrivateCritSec = 4
  28. } States;
  29. /********************************************************************
  30. Valid TMSTATUS states:
  31. NULL -- Normal processing
  32. DESTROY_REQ -- No new jobs, jobs possibly running
  33. DESTROY_REQ, DESTROYED -- No new jobs, all jobs completed
  34. ********************************************************************/
  35. TState _State;
  36. UINT _uIdleLife;
  37. UINT _uMaxThreads;
  38. UINT _uActiveThreads;
  39. UINT _uRunNowThreads;
  40. INT _iIdleThreads;
  41. HANDLE _hTrigger;
  42. MCritSec* _pCritSec;
  43. DWORD
  44. dwThreadProc(
  45. VOID
  46. );
  47. static DWORD
  48. xdwThreadProc(
  49. PVOID pVoid
  50. );
  51. virtual PJOB
  52. pThreadMJobNext(
  53. VOID
  54. ) = 0;
  55. virtual VOID
  56. vThreadMJobProcess(
  57. PJOB pJob
  58. ) = 0;
  59. virtual VOID
  60. vThreadMDeleteComplete(
  61. VOID
  62. );
  63. protected:
  64. TThreadM(
  65. UINT uMaxThreads,
  66. UINT uIdleLife,
  67. MCritSec* pCritSec
  68. );
  69. virtual
  70. ~TThreadM(
  71. VOID
  72. );
  73. BOOL
  74. bValid(
  75. VOID
  76. ) const
  77. {
  78. return _hTrigger != NULL;
  79. }
  80. BOOL
  81. bJobAdded(
  82. BOOL bRunNow
  83. );
  84. VOID
  85. vDelete(
  86. VOID
  87. );
  88. };
  89. #endif