24 #ifndef __CORE_UTILS_RWLOCK_QUEUE_H_ 25 #define __CORE_UTILS_RWLOCK_QUEUE_H_ 27 #include <core/threading/read_write_lock.h> 28 #include <core/utils/refptr.h> 34 template <
typename Type>
74 template <
typename Type>
84 template <
typename Type>
86 :
std::queue<Type>::queue(ll)
93 template <
typename Type>
101 template <
typename Type>
105 __rwlock->lock_for_read();
110 template <
typename Type>
114 __rwlock->lock_for_write();
121 template <
typename Type>
125 return __rwlock->try_lock_for_read();
132 template <
typename Type>
136 return __rwlock->try_lock_for_write();
141 template <
typename Type>
145 return __rwlock->unlock();
152 template <
typename Type>
156 __rwlock->lock_for_write();
157 std::queue<Type>::push(x);
164 template <
typename Type>
168 __rwlock->lock_for_write();
169 std::queue<Type>::pop();
175 template <
typename Type>
179 __rwlock->lock_for_write();
180 while ( ! std::queue<Type>::empty() ) {
181 std::queue<Type>::pop();
191 template <
typename Type>
void pop_locked()
Pop element from queue with lock protection.
Queue with a read/write lock.
bool try_lock_for_write()
Try to lock queue for writing.
Fawkes library namespace.
RefPtr< ReadWriteLock > rwlock() const
Get access to the internal rwlock.
void lock_for_read()
Lock queue for reading.
virtual ~RWLockQueue()
Destructor.
bool try_lock_for_read()
Try to lock queue for reading.
void clear()
Clear the queue.
void push_locked(const Type &x)
Push element to queue with lock protection.
void lock_for_write()
Lock queue for writing.
void unlock()
Unlock list.
Read/write lock to allow multiple readers but only a single writer on the resource at a time...
RefPtr<> is a reference-counting shared smartpointer.
RWLockQueue()
Constructor.