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.cxx
  7. //
  8. // Contents: CTask class implementation.
  9. //
  10. // Classes: CTask
  11. //
  12. // Functions: None.
  13. //
  14. // History: 25-Oct-95 MarkBl Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #include "..\pch\headers.hxx"
  18. #pragma hdrstop
  19. #include "debug.hxx"
  20. #include "task.hxx"
  21. //+---------------------------------------------------------------------------
  22. //
  23. // Method: CTask::AddRef
  24. //
  25. // Synopsis: Increment the task reference count.
  26. //
  27. // Arguments: None.
  28. //
  29. // Returns: ULONG reference count.
  30. //
  31. // Notes: None.
  32. //
  33. //----------------------------------------------------------------------------
  34. ULONG
  35. CTask::AddRef(void)
  36. {
  37. ULONG ulTmp = InterlockedIncrement((LONG *)&_cReferences);
  38. schDebugOut((DEB_USER3,
  39. "CTask::AddRef(0x%x) _cReferences(%d)\n",
  40. this,
  41. ulTmp));
  42. return(ulTmp);
  43. }
  44. //+---------------------------------------------------------------------------
  45. //
  46. // Method: CTask::Release
  47. //
  48. // Synopsis: Decrement the task reference count.
  49. //
  50. // Arguments: None.
  51. //
  52. // Returns: ULONG reference count.
  53. //
  54. // Notes: None.
  55. //
  56. //----------------------------------------------------------------------------
  57. ULONG
  58. CTask::Release(void)
  59. {
  60. ULONG ulTmp = InterlockedDecrement((LONG *)&_cReferences);
  61. schDebugOut((DEB_USER3,
  62. "CTask::Release(0x%x) _cReferences(%d)\n",
  63. this,
  64. ulTmp));
  65. if (ulTmp == 0)
  66. {
  67. delete this;
  68. }
  69. return(ulTmp);
  70. }