20 #ifndef GALOIS_WORKLIST_WORKLISTHELPERS_H
21 #define GALOIS_WORKLIST_WORKLISTHELPERS_H
23 #include <boost/iterator/iterator_facade.hpp>
25 #include "galois/config.h"
39 T*
const&
getNext()
const {
return next; }
44 :
public boost::iterator_facade<ConExtIterator<T>, T,
45 boost::forward_traversal_tag> {
49 template <
typename OtherTy>
54 T& dereference()
const {
return *at; }
55 void increment() { at = at->getNext(); }
60 template <
typename OtherTy>
66 template <
typename T,
bool concurrent>
74 bool empty()
const {
return !head.getValue(); }
79 oldhead = head.getValue();
80 C->getNext() = oldhead;
81 }
while (!head.CAS(oldhead, C));
91 T* C = head.getValue();
96 head.unlock_and_set(C->getNext());
114 template <
typename T,
bool concurrent>
125 bool empty()
const {
return !tail; }
136 assert(!head.getValue());
138 head.unlock_and_set(C);
148 T* C = head.getValue();
155 assert(!C->getNext());
156 head.unlock_and_clear();
158 head.unlock_and_set(C->getNext());
177 template <
typename T>
Definition: WorkListHelpers.h:33
Definition: WorkListHelpers.h:67
Definition: WorkListHelpers.h:43
T * pop()
Definition: WorkListHelpers.h:142
Definition: WorkListHelpers.h:115
PtrLock is a spinlock and a pointer.
Definition: PtrLock.h:42
T & reference
Definition: WorkListHelpers.h:103
friend class boost::iterator_core_access
Definition: WorkListHelpers.h:46
iterator end()
Definition: WorkListHelpers.h:171
iterator end()
Definition: WorkListHelpers.h:108
Definition: WorkListHelpers.h:178
bool empty() const
Definition: WorkListHelpers.h:125
T value_type
iterators not safe with concurrent modifications
Definition: WorkListHelpers.h:165
T * pop()
Definition: WorkListHelpers.h:84
const_iterator end() const
Definition: WorkListHelpers.h:174
ConExtIterator()
Definition: WorkListHelpers.h:58
const_iterator begin() const
Definition: WorkListHelpers.h:173
ConExtIterator(const ConExtIterator< OtherTy > &o)
Definition: WorkListHelpers.h:61
iterator begin()
Definition: WorkListHelpers.h:107
const_iterator begin() const
Definition: WorkListHelpers.h:110
ConExtListNode()
Definition: WorkListHelpers.h:37
ConExtIterator< const T > const_iterator
Definition: WorkListHelpers.h:105
ConExtIterator< T > iterator
Definition: WorkListHelpers.h:104
ConExtListNode< T > ListNode
Definition: WorkListHelpers.h:72
ConExtListNode< T > ListNode
Definition: WorkListHelpers.h:121
unsigned operator()(const T &)
Definition: WorkListHelpers.h:179
void push(T *C)
Definition: WorkListHelpers.h:76
T & reference
Definition: WorkListHelpers.h:166
const_iterator end() const
Definition: WorkListHelpers.h:111
T *const & getNext() const
Definition: WorkListHelpers.h:39
void push(T *C)
Definition: WorkListHelpers.h:127
ConExtIterator< T > iterator
Definition: WorkListHelpers.h:167
iterator begin()
Definition: WorkListHelpers.h:170
ConExtLinkedQueue()
Definition: WorkListHelpers.h:123
T value_type
iterators not safe with concurrent modifications
Definition: WorkListHelpers.h:102
ConExtIterator(T *x)
Definition: WorkListHelpers.h:63
T *& getNext()
Definition: WorkListHelpers.h:38
bool empty() const
Definition: WorkListHelpers.h:74
ConExtIterator< const T > const_iterator
Definition: WorkListHelpers.h:168