File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ class SpinLockMRSW{
8989 }
9090 }
9191
92+ PA_FORCE_INLINE bool try_acquire_write (){
93+ size_t state = 0 ;
94+ return m_readers.compare_exchange_strong (state, (size_t )-1 );
95+ }
96+
9297 PA_FORCE_INLINE void unlock_read (){
9398 m_readers.fetch_sub (1 );
9499 }
@@ -134,7 +139,11 @@ class WriteSpinLock{
134139 WriteSpinLock (const WriteSpinLock&) = delete ;
135140 void operator =(const WriteSpinLock&) = delete ;
136141
137- PA_FORCE_INLINE WriteSpinLock (SpinLockMRSW& lock, const char * label = " (unnamed lock)" )
142+ PA_FORCE_INLINE WriteSpinLock (
143+ SpinLockMRSW& lock,
144+ const char * label = " (unnamed lock)" ,
145+ bool try_acquire = false
146+ )
138147 : m_lock(lock)
139148 {
140149 lock.acquire_write (label);
You can’t perform that action at this time.
0 commit comments