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.

38 lines
776 B

  1. //***************************************************************************
  2. //
  3. // Copyright � Microsoft Corporation. All rights reserved.
  4. //
  5. // LockWrap.h
  6. //
  7. // Purpose: Wrapper class for critical sections
  8. //
  9. //***************************************************************************
  10. #include "stllock.h"
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. // You use this class by passing via the constructor the name of the
  15. // critical section you want to lock. When the CLockWrapper goes
  16. // out of scope it will unlock itself.
  17. class CLockWrapper
  18. {
  19. public:
  20. CLockWrapper(CCritSec &cs)
  21. {
  22. m_pCS = &cs;
  23. m_pCS->Enter();
  24. }
  25. ~CLockWrapper()
  26. {
  27. m_pCS->Leave();
  28. }
  29. protected:
  30. CCritSec *m_pCS;
  31. };