MCPcopy Create free account
hub / github.com/3rdparty/libprocess / for_each

Method for_each

src/mpsc_linked_queue.hpp:140–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 // the `std::for_each()`.
139 template <typename F>
140 void for_each(F&& f)
141 {
142 auto end = head.load();
143 auto node = tail;
144
145 for (;;) {
146 node = node->next.load();
147
148 // We are following the linked structure until we reach the end
149 // node. There is a race with new nodes being added, so we limit
150 // the traversal to the last node at the time we started.
151 if (node == nullptr) {
152 return;
153 }
154
155 f(node->element);
156
157 if (node == end) {
158 return;
159 }
160 }
161 }
162
163 // Single consumer only.
164 bool empty()

Callers 3

countMethod · 0.80
EventQueueClass · 0.80
TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64