MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_flush_input_queue

Function ng_flush_input_queue

lib/ff_ng_base.c:2178–2204  ·  view source on GitHub ↗

Purge node queue. Called on node shutdown. */

Source from the content-addressed store, hash-verified

2176
2177/* Purge node queue. Called on node shutdown. */
2178static void
2179ng_flush_input_queue(node_p node)
2180{
2181 struct ng_queue *ngq = &node->nd_input_queue;
2182 item_p item;
2183
2184 NG_QUEUE_LOCK(ngq);
2185 while ((item = STAILQ_FIRST(&ngq->queue)) != NULL) {
2186 STAILQ_REMOVE_HEAD(&ngq->queue, el_next);
2187 if (STAILQ_EMPTY(&ngq->queue))
2188 atomic_clear_int(&ngq->q_flags, OP_PENDING);
2189 NG_QUEUE_UNLOCK(ngq);
2190
2191 /* If the item is supplying a callback, call it with an error */
2192 if (item->apply != NULL) {
2193 if (item->depth == 1)
2194 item->apply->error = ENOENT;
2195 if (refcount_release(&item->apply->refs)) {
2196 (*item->apply->apply)(item->apply->context,
2197 item->apply->error);
2198 }
2199 }
2200 NG_FREE_ITEM(item);
2201 NG_QUEUE_LOCK(ngq);
2202 }
2203 NG_QUEUE_UNLOCK(ngq);
2204}
2205#endif
2206
2207/***********************************************************************

Callers 1

ng_rmnodeFunction · 0.70

Calls 1

refcount_releaseFunction · 0.85

Tested by

no test coverage detected