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

Function gtaskqueue_thread_loop

freebsd/kern/subr_gtaskqueue.c:536–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536static void
537gtaskqueue_thread_loop(void *arg)
538{
539 struct gtaskqueue **tqp, *tq;
540
541 tqp = arg;
542 tq = *tqp;
543 gtaskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT);
544 TQ_LOCK(tq);
545 while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
546 /* XXX ? */
547 gtaskqueue_run_locked(tq);
548 /*
549 * Because taskqueue_run() can drop tq_mutex, we need to
550 * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the
551 * meantime, which means we missed a wakeup.
552 */
553 if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0)
554 break;
555 TQ_SLEEP(tq, tq, "-");
556 }
557 gtaskqueue_run_locked(tq);
558 /*
559 * This thread is on its way out, so just drop the lock temporarily
560 * in order to call the shutdown callback. This allows the callback
561 * to look at the taskqueue, even just before it dies.
562 */
563 TQ_UNLOCK(tq);
564 gtaskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN);
565 TQ_LOCK(tq);
566
567 /* rendezvous with thread that asked us to terminate */
568 tq->tq_tcount--;
569 wakeup_one(tq->tq_threads);
570 TQ_UNLOCK(tq);
571 kthread_exit();
572}
573
574static void
575gtaskqueue_thread_enqueue(void *context)

Callers

nothing calls this directly

Calls 5

gtaskqueue_run_callbackFunction · 0.85
gtaskqueue_run_lockedFunction · 0.85
TQ_SLEEPFunction · 0.70
wakeup_oneFunction · 0.70
kthread_exitFunction · 0.70

Tested by

no test coverage detected