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