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

Function taskqueue_thread_loop

freebsd/kern/subr_taskqueue.c:803–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803void
804taskqueue_thread_loop(void *arg)
805{
806 struct taskqueue **tqp, *tq;
807
808 tqp = arg;
809 tq = *tqp;
810 taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT);
811 TQ_LOCK(tq);
812 while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
813 /* XXX ? */
814 taskqueue_run_locked(tq);
815 /*
816 * Because taskqueue_run() can drop tq_mutex, we need to
817 * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the
818 * meantime, which means we missed a wakeup.
819 */
820 if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0)
821 break;
822 TQ_SLEEP(tq, tq, "-");
823 }
824 taskqueue_run_locked(tq);
825 /*
826 * This thread is on its way out, so just drop the lock temporarily
827 * in order to call the shutdown callback. This allows the callback
828 * to look at the taskqueue, even just before it dies.
829 */
830 TQ_UNLOCK(tq);
831 taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN);
832 TQ_LOCK(tq);
833
834 /* rendezvous with thread that asked us to terminate */
835 tq->tq_tcount--;
836 wakeup_one(tq->tq_threads);
837 TQ_UNLOCK(tq);
838 kthread_exit();
839}
840
841void
842taskqueue_thread_enqueue(void *context)

Callers

nothing calls this directly

Calls 5

taskqueue_run_callbackFunction · 0.85
taskqueue_run_lockedFunction · 0.85
TQ_SLEEPFunction · 0.70
wakeup_oneFunction · 0.70
kthread_exitFunction · 0.70

Tested by

no test coverage detected