1 #ifndef LIBFILEZILLA_RWMUTEX_HEADER
2 #define LIBFILEZILLA_RWMUTEX_HEADER
11 #include "glue/windows.hpp"
31 pthread_rwlock_init(&m_,
nullptr);
35 pthread_rwlock_destroy(&m_);
46 AcquireSRWLockShared(&m_);
48 pthread_rwlock_rdlock(&m_);
55 AcquireSRWLockExclusive(&m_);
57 pthread_rwlock_wrlock(&m_);
65 ReleaseSRWLockShared(&m_);
67 pthread_rwlock_unlock(&m_);
74 ReleaseSRWLockExclusive(&m_);
76 pthread_rwlock_unlock(&m_);
81 friend class scoped_read_lock;
82 friend class scoped_write_lock;
106 AcquireSRWLockShared(m_);
108 pthread_rwlock_rdlock(m_);
116 ReleaseSRWLockShared(m_);
118 pthread_rwlock_unlock(m_);
131 locked_ = op.locked_;
140 locked_ = op.locked_;
154 AcquireSRWLockShared(m_);
156 pthread_rwlock_rdlock(m_);
168 ReleaseSRWLockShared(m_);
170 pthread_rwlock_unlock(m_);
178 pthread_rwlock_t* m_;
180 bool locked_{
true };
195 AcquireSRWLockExclusive(m_);
197 pthread_rwlock_wrlock(m_);
205 ReleaseSRWLockExclusive(m_);
207 pthread_rwlock_unlock(m_);
220 locked_ = op.locked_;
229 locked_ = op.locked_;
243 AcquireSRWLockExclusive(m_);
245 pthread_rwlock_wrlock(m_);
257 ReleaseSRWLockExclusive(m_);
259 pthread_rwlock_unlock(m_);
267 pthread_rwlock_t* m_;
269 bool locked_{
true };
Lean rw mutex.
Definition: rwmutex.hpp:24
void lock_read()
Beware, manual locking isn't exception safe, use scoped_lock.
Definition: rwmutex.hpp:43
void unlock_read()
Beware, manual locking isn't exception safe, use scoped_lock.
Definition: rwmutex.hpp:62
A simple scoped read lock.
Definition: rwmutex.hpp:100
void unlock()
Releases the mutex.
Definition: rwmutex.hpp:164
void lock()
Obtains the mutex.
Definition: rwmutex.hpp:150
A simple scoped read lock.
Definition: rwmutex.hpp:189
void unlock()
Releases the mutex.
Definition: rwmutex.hpp:253
void lock()
Obtains the mutex.
Definition: rwmutex.hpp:239
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition: apply.hpp:17
Assorted classes dealing with time.