5 #include <libutl/Mutex.h> 41 void forEach(std::function<
void(T)> f)
const;
62 char pad0[UTL_CACHE_LINE_SIZE];
65 char pad1[UTL_CACHE_LINE_SIZE -
sizeof(Node*)];
68 char pad2[UTL_CACHE_LINE_SIZE -
sizeof(Node*)];
76 _head = _tail =
new Node();
84 while (_head !=
nullptr)
98 Node* node =
new Node(value);
101 _producerLock.lock();
108 _producerLock.unlock();
113 template <
typename T>
117 _consumerLock.lock();
121 Node* next = _head->next;
126 _consumerLock.unlock();
135 _consumerLock.unlock();
145 template <
typename T>
153 if (node ==
nullptr)
break;
utl::ConcurrentQueue that uses mutexes for the producer & consumer locks.