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.

68 lines
1.7 KiB

  1. /***************************************************************************\
  2. *
  3. * File: TempHelp.inl
  4. *
  5. * History:
  6. * 3/30/2000: JStall: Created
  7. *
  8. * Copyright (C) 2000 by Microsoft Corporation. All rights reserved.
  9. *
  10. \***************************************************************************/
  11. #if !defined(BASE__TempHeap_inl__INCLUDED)
  12. #define BASE__TempHeap_inl__INCLUDED
  13. #pragma once
  14. /***************************************************************************\
  15. *****************************************************************************
  16. *
  17. * class TempHeap
  18. *
  19. *****************************************************************************
  20. \***************************************************************************/
  21. //------------------------------------------------------------------------------
  22. inline
  23. TempHeap::~TempHeap()
  24. {
  25. Destroy();
  26. }
  27. //------------------------------------------------------------------------------
  28. inline void
  29. TempHeap::Destroy()
  30. {
  31. FreeAll(TRUE /* Complete */);
  32. }
  33. //------------------------------------------------------------------------------
  34. inline BOOL
  35. TempHeap::IsCompletelyFree() const
  36. {
  37. return (m_ppageCur == NULL) && (m_ppageLarge == NULL);
  38. }
  39. //------------------------------------------------------------------------------
  40. inline void
  41. TempHeap::Lock()
  42. {
  43. m_cLocks++;
  44. }
  45. //------------------------------------------------------------------------------
  46. inline void
  47. TempHeap::Unlock()
  48. {
  49. AssertMsg(m_cLocks > 0, "Must have an outstanding lock");
  50. if (--m_cLocks == 0) {
  51. FreeAll(FALSE);
  52. }
  53. }
  54. #endif // BASE__TempHeap_inl__INCLUDED