StlLock.h 700 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  4. //
  5. // stllock.h
  6. //
  7. // Purpose: Critical section class
  8. //
  9. //***************************************************************************
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #ifndef _STLLOCK_H_
  14. #define _STLLOCK_H_
  15. class CCritSec : public CRITICAL_SECTION
  16. {
  17. public:
  18. CCritSec()
  19. {
  20. InitializeCriticalSection(this);
  21. }
  22. ~CCritSec()
  23. {
  24. DeleteCriticalSection(this);
  25. }
  26. void Enter()
  27. {
  28. EnterCriticalSection(this);
  29. }
  30. void Leave()
  31. {
  32. LeaveCriticalSection(this);
  33. }
  34. };
  35. #endif