24 #include <core/threading/read_write_lock.h>
25 #include <core/threading/scoped_rwlock.h>
97 lock_type_ = lock_type;
100 refrwlock_->lock_for_write();
102 refrwlock_->lock_for_read();
105 locked_ = initially_lock;
119 lock_type_ = lock_type;
120 if (initially_lock) {
127 locked_ = initially_lock;
137 refrwlock_->unlock();
156 refrwlock_->lock_for_write();
158 refrwlock_->lock_for_read();
172 refrwlock_->unlock();
Read/write lock to allow multiple readers but only a single writer on the resource at a time.
void unlock()
Release the lock.
void lock_for_read()
Aquire a reader lock.
void lock_for_write()
Aquire a writer lock.
RefPtr<> is a reference-counting shared smartpointer.
LockType
What to lock for.
@ LOCK_WRITE
Lock for writing.
void relock()
Lock this rwlock, again.
ScopedRWLock(RefPtr< ReadWriteLock > rwlock, LockType lock_type=LOCK_WRITE, bool initially_lock=true)
Constructor.
void unlock()
Unlock the rwlock.
~ScopedRWLock()
Destructor.
Fawkes library namespace.