You.i Engine
YiAutoSpinLock.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_AUTO_SPIN_LOCK_H_
3 #define _YI_AUTO_SPIN_LOCK_H_
4 
5 #include "thread/YiSpinLock.h"
6 
7 namespace yi
8 {
14 namespace deprecated
15 {
98 {
99 public:
103  CYIAutoSpinLock(CYISpinLock &rSpinLock);
104 
109 
113  void Relock();
114 
118  void Unlock();
119 
120 private:
122  CYIAutoSpinLock &operator=(const CYIAutoSpinLock &);
123 
124  CYISpinLock &m_rSpinLock;
125 };
126 
127 } // namespace deprecated
128 
131 } // namespace yi
132 
134  : m_rSpinLock(rSpinLock)
135 {
136  m_rSpinLock.Lock();
137 }
138 
140 {
141  m_rSpinLock.Unlock();
142 }
143 
145 {
146  m_rSpinLock.Lock();
147 }
148 
150 {
151  m_rSpinLock.Unlock();
152 }
153 
154 #endif /* _YI_AUTO_SPIN_LOCK_H_ */
Definition: YiAutoProfiler.h:7
void Relock()
Definition: YiAutoSpinLock.h:144
CYIAutoSpinLock(CYISpinLock &rSpinLock)
Definition: YiAutoSpinLock.h:133
void Unlock()
The CYIAutoSpinLock is a helper class that simplifies the locking and unlocking of spin locks based o...
Definition: YiAutoSpinLock.h:97
Provides access serialization between threads, where a thread trying to acquire the lock waits in a l...
Definition: YiSpinLock.h:31
~CYIAutoSpinLock()
Definition: YiAutoSpinLock.h:139
void Unlock()
Definition: YiAutoSpinLock.h:149