24 #ifndef __CORE_UTILS_LOCK_LIST_H_ 25 #define __CORE_UTILS_LOCK_LIST_H_ 27 #include <core/threading/mutex.h> 28 #include <core/utils/refptr.h> 43 template <
typename Type>
44 class LockList :
public std::list<Type>
60 virtual void lock()
const;
68 virtual void unlock()
const;
114 template <
typename Type>
116 : __mutex(new
Mutex())
120 template <
typename Type>
122 :
std::list<Type>::list(ll), __mutex(new
Mutex())
126 template <
typename Type>
134 template <
typename Type>
142 template <
typename Type>
150 template <
typename Type>
155 std::list<Type>::push_back(x);
160 template <
typename Type>
165 std::list<Type>::push_front(x);
170 template <
typename Type>
175 std::list<Type>::remove(x);
180 template <
typename Type>
188 template <
typename Type>
196 for (i = ll.begin(); i != ll.end(); ++i) {
206 template <
typename Type>
212 typename std::list<Type>::const_iterator i;
213 for (i = l.begin(); i != l.end(); ++i) {
LockList< Type > & operator=(const LockList< Type > &ll)
Copy values from another LockList.
virtual void lock() const
Lock list.
Fawkes library namespace.
void push_back_locked(const Type &x)
Push element to list at back with lock protection.
void remove_locked(const Type &x)
Remove element from list with lock protection.
RefPtr< Mutex > mutex() const
Get access to the internal mutex.
virtual bool try_lock() const
Try to lock list.
virtual void unlock() const
Unlock list.
void push_front_locked(const Type &x)
Push element to list at front with lock protection.
virtual ~LockList()
Destructor.
RefPtr<> is a reference-counting shared smartpointer.
Mutex mutual exclusion lock.