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.

78 lines
1.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: task.hxx
  7. //
  8. // Contents: CTask class definition.
  9. //
  10. // Classes: CTask
  11. //
  12. // Functions: None.
  13. //
  14. // History: 25-Oct-95 MarkBl Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __TASK_HXX__
  18. #define __TASK_HXX__
  19. //+---------------------------------------------------------------------------
  20. //
  21. // Class: CTask
  22. //
  23. // Synopsis: Classes inherit from this for task abstraction.
  24. //
  25. // History: 6-Apr-95 MarkBl Created
  26. //
  27. // Notes: None.
  28. //
  29. //----------------------------------------------------------------------------
  30. //
  31. // Task status flag values.
  32. //
  33. #define TASK_STATUS_UNSERVICED 0x00
  34. #define TASK_STATUS_IN_SERVICE 0x01
  35. class CTask
  36. {
  37. public:
  38. CTask(VOID) : _cReferences(1), _rgfStatus(0) { TRACE3(CTask, CTask); }
  39. virtual ~CTask() { TRACE3(CTask, ~CTask); }
  40. virtual void PerformTask(void) = 0;
  41. BOOL IsInService(void) {
  42. return(_rgfStatus & TASK_STATUS_IN_SERVICE ? TRUE : FALSE);
  43. }
  44. void InService(void) {
  45. _rgfStatus |= TASK_STATUS_IN_SERVICE;
  46. }
  47. void UnServiced(void) {
  48. _rgfStatus &= ~TASK_STATUS_IN_SERVICE;
  49. }
  50. ULONG AddRef(void);
  51. ULONG Release(void);
  52. //
  53. // Be *extremely* careful with this member!
  54. //
  55. ULONG GetReferenceCount() { return(_cReferences); }
  56. private:
  57. ULONG _cReferences;
  58. BYTE _rgfStatus;
  59. };
  60. #endif // __TASK_HXX__