Leaked source code of windows server 2003
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.

122 lines
3.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: jpmgr.hxx
  7. //
  8. // Contents: CJobProcessorMgr class definition.
  9. //
  10. // Classes: CJobProcessorMgr
  11. //
  12. // Functions: None.
  13. //
  14. // History: 25-Oct-95 MarkBl Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __JPMGR_HXX__
  18. #define __JPMGR_HXX__
  19. class CJobProcessor; // Forward reference.
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Class: CJobProcessorQueue
  23. //
  24. // Synopsis: Queue of CJobProcessor.
  25. //
  26. // History: 25-Oct-95 MarkBl Created
  27. //
  28. // Notes: None.
  29. //
  30. //----------------------------------------------------------------------------
  31. class CJobProcessorQueue : public CQueue
  32. {
  33. public:
  34. CJobProcessorQueue(void) {
  35. TRACE3(CJobProcessorQueue, CJobProcessorQueue);
  36. }
  37. ~CJobProcessorQueue();
  38. void AddElement(CJobProcessor * pjp) {
  39. schDebugOut((DEB_USER3,
  40. "CJobProcessorQueue::AddElement(0x%x) pjp(0x%x)\n",
  41. this,
  42. pjp));
  43. CQueue::AddElement((CDLink *)pjp);
  44. }
  45. CJobProcessor * GetFirstElement(void) {
  46. TRACE3(CJobProcessorQueue, GetFirstElement);
  47. return((CJobProcessor *)CQueue::GetFirstElement());
  48. }
  49. CJobProcessor * RemoveElement(void) {
  50. TRACE3(CJobProcessorQueue, RemoveElement);
  51. return((CJobProcessor *)CQueue::RemoveElement());
  52. }
  53. CJobProcessor * RemoveElement(CJobProcessor * pjp) {
  54. schDebugOut((DEB_USER3,
  55. "CJobProcessorQueue::RemoveElement(0x%x) pjp)\n",
  56. this,
  57. pjp));
  58. return((CJobProcessor *)CQueue::RemoveElement((CDLink *)pjp));
  59. }
  60. };
  61. //+---------------------------------------------------------------------------
  62. //
  63. // Class: CJobProcessorMgr
  64. //
  65. // Synopsis: Job processor pool managment class.
  66. //
  67. // History: 25-Oct-95 MarkBl Created
  68. //
  69. // Notes: None.
  70. //
  71. //----------------------------------------------------------------------------
  72. class CJobProcessorMgr
  73. {
  74. public:
  75. CJobProcessorMgr(void) {
  76. TRACE3(CJobProcessorMgr, CJobProcessorMgr);
  77. InitializeCriticalSection(&_csProcessorMgrCritSection);
  78. }
  79. ~CJobProcessorMgr() {
  80. TRACE3(CJobProcessorMgr, ~CJobProcessorMgr);
  81. DeleteCriticalSection(&_csProcessorMgrCritSection);
  82. }
  83. HRESULT NewProcessor(CJobProcessor ** ppjp);
  84. void GarbageCollection(void);
  85. CJobProcessor * GetFirstProcessor(void);
  86. void LockProcessorPool(void) {
  87. TRACE3(CJobProcessorMgr, LockProcessorPool);
  88. EnterCriticalSection(&_csProcessorMgrCritSection);
  89. }
  90. void UnlockProcessorPool(void) {
  91. TRACE3(CJobProcessorMgr, UnlockProcessorPool);
  92. LeaveCriticalSection(&_csProcessorMgrCritSection);
  93. }
  94. void Shutdown(void);
  95. private:
  96. CRITICAL_SECTION _csProcessorMgrCritSection;
  97. CJobProcessorQueue _JobProcessorQueue;
  98. };
  99. #endif // __JPMGR_HXX__