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.

67 lines
2.8 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: SingleThreadedExecution.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // Classes that handle state preservation, changing and restoration.
  7. //
  8. // History: 1999-08-18 vtan created
  9. // 1999-11-16 vtan separate file
  10. // 2000-02-01 vtan moved from Neptune to Whistler
  11. // --------------------------------------------------------------------------
  12. #ifndef _SingleThreadedExecution_
  13. #define _SingleThreadedExecution_
  14. #include "KernelResources.h"
  15. // --------------------------------------------------------------------------
  16. // CSingleThreadedExecution
  17. //
  18. // Purpose: This class acquires the given critical section object in its
  19. // constructor and releases it in its destructor. Keep code
  20. // executed with the scope of this object to a minimum to avoid
  21. // impacting performance.
  22. //
  23. // History: 1999-11-06 vtan created
  24. // 2000-02-01 vtan moved from Neptune to Whistler
  25. // --------------------------------------------------------------------------
  26. class CSingleThreadedExecution
  27. {
  28. private:
  29. CSingleThreadedExecution (void);
  30. const CSingleThreadedExecution& operator = (const CSingleThreadedExecution& assignObject);
  31. public:
  32. CSingleThreadedExecution (CCriticalSection& criticalSection);
  33. ~CSingleThreadedExecution (void);
  34. private:
  35. CCriticalSection& _criticalSection;
  36. };
  37. // --------------------------------------------------------------------------
  38. // CSingleThreadedMutexExecution
  39. //
  40. // Purpose: This class acquires the given CMutex object in its constructor
  41. // and releases it in its destructor. Keep code executed with
  42. // the scope of this object to a minimum to avoid impacting
  43. // performance.
  44. //
  45. // History: 1999-10-13 vtan created
  46. // 2000-02-01 vtan moved from Neptune to Whistler
  47. // --------------------------------------------------------------------------
  48. class CSingleThreadedMutexExecution
  49. {
  50. private:
  51. CSingleThreadedMutexExecution (void);
  52. const CSingleThreadedMutexExecution& operator = (const CSingleThreadedMutexExecution& assignObject);
  53. public:
  54. CSingleThreadedMutexExecution (CMutex& mutex);
  55. ~CSingleThreadedMutexExecution (void);
  56. private:
  57. CMutex& _hMutex;
  58. };
  59. #endif /* _SingleThreadedExecution_ */