24#ifndef _CORE_UTILS_RWLOCK_LIST_H_
25#define _CORE_UTILS_RWLOCK_LIST_H_
27#include <core/threading/read_write_lock.h>
28#include <core/utils/refptr.h>
34template <
typename Type>
70template <
typename Type>
78template <
typename Type>
85template <
typename Type>
91template <
typename Type>
95 rwlock_->lock_for_read();
99template <
typename Type>
103 rwlock_->lock_for_write();
109template <
typename Type>
113 return rwlock_->try_lock_for_read();
119template <
typename Type>
123 return rwlock_->try_lock_for_write();
127template <
typename Type>
131 return rwlock_->unlock();
137template <
typename Type>
141 rwlock_->lock_for_write();
142 std::list<Type>::push_back(x);
149template <
typename Type>
153 rwlock_->lock_for_write();
154 std::list<Type>::push_front(x);
161template <
typename Type>
165 rwlock_->lock_for_write();
166 std::list<Type>::remove(x);
173template <
typename Type>
186template <
typename Type>
190 rwlock_->lock_for_write();
194 for (i = ll.begin(); i != ll.end(); ++i) {
209template <
typename Type>
213 rwlock_->lock_for_write();
215 typename std::list<Type>::const_iterator i;
216 for (i = l.begin(); i != l.end(); ++i) {
List with a read/write lock.
RWLockList< Type > & operator=(const RWLockList< Type > &ll)
Copy values from another RWLockList.
virtual bool try_lock_for_read()
Try to lock list for reading.
void remove_locked(const Type &x)
Remove element from list with lock protection.
RefPtr< ReadWriteLock > rwlock() const
Get access to the internal read/write lock.
void push_back_locked(const Type &x)
Push element to list at back with lock protection.
virtual bool try_lock_for_write()
Try to lock list for writing.
virtual void lock_for_write()
Lock list for writing.
void push_front_locked(const Type &x)
Push element to list at front with lock protection.
virtual ~RWLockList()
Destructor.
virtual void lock_for_read()
Lock list for reading.
virtual 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.
Fawkes library namespace.