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

Function taskqueue_drain_tq_active

freebsd/kern/subr_taskqueue.c:401–428  ·  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

399 * of this function are ignored.
400 */
401static int
402taskqueue_drain_tq_active(struct taskqueue *queue)
403{
404 struct taskqueue_busy *tb;
405 u_int seq;
406
407 if (LIST_EMPTY(&queue->tq_active))
408 return (0);
409
410 /* Block taskq_terminate().*/
411 queue->tq_callouts++;
412
413 /* Wait for any active task with sequence from the past. */
414 seq = queue->tq_seq;
415restart:
416 LIST_FOREACH(tb, &queue->tq_active, tb_link) {
417 if ((int)(tb->tb_seq - seq) <= 0) {
418 TQ_SLEEP(queue, tb->tb_running, "tq_adrain");
419 goto restart;
420 }
421 }
422
423 /* Release taskqueue_terminate(). */
424 queue->tq_callouts--;
425 if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0)
426 wakeup_one(queue->tq_threads);
427 return (1);
428}
429
430void
431taskqueue_block(struct taskqueue *queue)

Callers 2

taskqueue_drain_allFunction · 0.85
taskqueue_quiesceFunction · 0.85

Calls 2

TQ_SLEEPFunction · 0.70
wakeup_oneFunction · 0.70

Tested by

no test coverage detected