RecursiveMutex.h 906 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // "$Id$"
  3. //
  4. // Copyright (c)1992-2011, ZheJiang Dahua Technology Stock CO.LTD.
  5. // All Rights Reserved.
  6. //
  7. // Description:
  8. // Revisions: Year-Month-Day SVN-Author Modification
  9. //
  10. #ifndef __INFRA3_RECURSIVE_MUTEX_H__
  11. #define __INFRA3_RECURSIVE_MUTEX_H__
  12. #include "Defs.h"
  13. namespace Dahua {
  14. namespace Infra {
  15. struct RecursiveMutexInternal;
  16. /// \class CRecursiveMutex 递归锁
  17. class INFRA_API CRecursiveMutex
  18. {
  19. CRecursiveMutex(CRecursiveMutex const&);
  20. CRecursiveMutex& operator=(CRecursiveMutex const&);
  21. public:
  22. /// 构造函数,会创建系统互斥量
  23. CRecursiveMutex();
  24. /// 析构函数,会销毁系统互斥量
  25. ~CRecursiveMutex();
  26. /// 进入临界区。
  27. /// \return 操作是否成功
  28. bool enter();
  29. /// 离开临界区。
  30. /// \return 操作是否成功
  31. bool leave();
  32. private:
  33. RecursiveMutexInternal *m_internal;
  34. };
  35. } // namespace Infra
  36. } // namespace Dahua
  37. #endif //__INFRA_RECURSIVE_MUTEX_H__
  38. //
  39. // End of "$Id$"
  40. //