StlLock.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:1k
源码类别:

模拟服务器

开发平台:

C/C++

  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