You.i Engine
YiAutoReadMutex.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_AUTO_READ_MUTEX_H_
3 #define _YI_AUTO_READ_MUTEX_H_
4 
6 
24 {
25 public:
30 
35 
39  bool Relock();
40 
44  bool Unlock();
45 
46 private:
48  CYIAutoReadMutex &operator=(const CYIAutoReadMutex &);
49 
50  CYIReadWriteMutex &m_rMutex;
51 };
52 
55 inline CYIAutoReadMutex::CYIAutoReadMutex(CYIReadWriteMutex &rMutex) : m_rMutex(rMutex)
56 {
57  m_rMutex.LockRead();
58 }
59 
61 {
62  m_rMutex.Unlock();
63 }
64 
66 {
67  return m_rMutex.LockRead();
68 }
69 
71 {
72  return m_rMutex.Unlock();
73 }
74 
75 #endif /* _YI_AUTO_READ_MUTEX_H_ */
bool Unlock()
Definition: YiAutoReadMutex.h:70
~CYIAutoReadMutex()
Definition: YiAutoReadMutex.h:60
bool Relock()
Definition: YiAutoReadMutex.h:65
Definition: YiReadWriteMutex.h:14
Definition: YiAutoReadMutex.h:23
CYIAutoReadMutex(CYIReadWriteMutex &rMutex)
Definition: YiAutoReadMutex.h:55