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

Function gtaskqueue_drain_tq_active

freebsd/kern/subr_gtaskqueue.c:294–320  ·  view source on GitHub ↗

* Block until all currently executing tasks for this taskqueue * complete. Tasks that begin execution during the execution * of this function are ignored. */

Source from the content-addressed store, hash-verified

292 * of this function are ignored.
293 */
294static void
295gtaskqueue_drain_tq_active(struct gtaskqueue *queue)
296{
297 struct gtaskqueue_busy *tb;
298 u_int seq;
299
300 if (LIST_EMPTY(&queue->tq_active))
301 return;
302
303 /* Block taskq_terminate().*/
304 queue->tq_callouts++;
305
306 /* Wait for any active task with sequence from the past. */
307 seq = queue->tq_seq;
308restart:
309 LIST_FOREACH(tb, &queue->tq_active, tb_link) {
310 if ((int)(tb->tb_seq - seq) <= 0) {
311 TQ_SLEEP(queue, tb->tb_running, "gtq_adrain");
312 goto restart;
313 }
314 }
315
316 /* Release taskqueue_terminate(). */
317 queue->tq_callouts--;
318 if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0)
319 wakeup_one(queue->tq_threads);
320}
321
322void
323gtaskqueue_block(struct gtaskqueue *queue)

Callers 1

gtaskqueue_drain_allFunction · 0.85

Calls 2

TQ_SLEEPFunction · 0.70
wakeup_oneFunction · 0.70

Tested by

no test coverage detected