You.i Engine
YiAutoSpinLock.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_AUTO_SPIN_LOCK_H_
3 #define _YI_AUTO_SPIN_LOCK_H_
4 
5 #include "thread/YiSpinLock.h"
6 
94 {
95 public:
96 
100  CYIAutoSpinLock(CYISpinLock &rSpinLock);
101 
106 
110  void Relock();
111 
115  void Unlock();
116 
117 private:
119  CYIAutoSpinLock &operator=(const CYIAutoSpinLock &);
120 
121  CYISpinLock &m_rSpinLock;
122 };
123 
127  m_rSpinLock(rSpinLock)
128 {
129  m_rSpinLock.Lock();
130 }
131 
133 {
134  m_rSpinLock.Unlock();
135 }
136 
138 {
139  m_rSpinLock.Lock();
140 }
141 
143 {
144  m_rSpinLock.Unlock();
145 }
146 
147 #endif /* _YI_AUTO_SPIN_LOCK_H_ */
CYIAutoSpinLock(CYISpinLock &rSpinLock)
Definition: YiAutoSpinLock.h:126
bool Unlock()
Definition: YiSpinLock.h:129
The CYIAutoSpinLock is a helper class that simplifies the locking and unlocking of spin locks based o...
Definition: YiAutoSpinLock.h:93
void Relock()
Definition: YiAutoSpinLock.h:137
Provides access serialization between threads, where a thread trying to acquire the lock waits in a l...
Definition: YiSpinLock.h:65
bool Lock()
Definition: YiSpinLock.h:109
~CYIAutoSpinLock()
Definition: YiAutoSpinLock.h:132
void Unlock()
Definition: YiAutoSpinLock.h:142