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.

93 lines
2.9 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: SingleThreadedExecution.cpp
  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. #include "StandardHeader.h"
  13. #include "SingleThreadedExecution.h"
  14. // --------------------------------------------------------------------------
  15. // CSingleThreadedExecution::CSingleThreadedExecution
  16. //
  17. // Arguments: criticalSection = CCriticalSection object containing the
  18. // critical section controlling the block
  19. // of single threaded execution.
  20. //
  21. // Returns: <none>
  22. //
  23. // Purpose: Acquires the given CriticalSection.
  24. //
  25. // History: 1999-11-06 vtan created
  26. // --------------------------------------------------------------------------
  27. CSingleThreadedExecution::CSingleThreadedExecution (CCriticalSection& criticalSection) :
  28. _criticalSection(criticalSection)
  29. {
  30. criticalSection.Acquire();
  31. }
  32. // --------------------------------------------------------------------------
  33. // CSingleThreadedExecution::~CSingleThreadedExecution
  34. //
  35. // Arguments: <none>
  36. //
  37. // Returns: <none>
  38. //
  39. // Purpose: Releases the single threaded execution critical section.
  40. //
  41. // History: 1999-11-06 vtan created
  42. // --------------------------------------------------------------------------
  43. CSingleThreadedExecution::~CSingleThreadedExecution (void)
  44. {
  45. _criticalSection.Release();
  46. }
  47. // --------------------------------------------------------------------------
  48. // CSingleThreadedMutexExecution::CSingleThreadedMutexExecution
  49. //
  50. // Arguments: mutex = CMutex object containing the mutex controlling
  51. // the block of single threaded execution.
  52. //
  53. // Returns: <none>
  54. //
  55. // Purpose: Acquires the given mutex.
  56. //
  57. // History: 1999-10-13 vtan created
  58. // --------------------------------------------------------------------------
  59. CSingleThreadedMutexExecution::CSingleThreadedMutexExecution (CMutex& mutex) :
  60. _hMutex(mutex)
  61. {
  62. mutex.Acquire();
  63. }
  64. // --------------------------------------------------------------------------
  65. // CSingleThreadedMutexExecution::~CSingleThreadedMutexExecution
  66. //
  67. // Arguments: <none>
  68. //
  69. // Returns: <none>
  70. //
  71. // Purpose: Releases the single threaded execution mutex.
  72. //
  73. // History: 1999-10-13 vtan created
  74. // --------------------------------------------------------------------------
  75. CSingleThreadedMutexExecution::~CSingleThreadedMutexExecution (void)
  76. {
  77. _hMutex.Release();
  78. }