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

Function gtaskqueue_run_locked

freebsd/kern/subr_gtaskqueue.c:342–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342static void
343gtaskqueue_run_locked(struct gtaskqueue *queue)
344{
345 struct epoch_tracker et;
346 struct gtaskqueue_busy tb;
347 struct gtask *gtask;
348 bool in_net_epoch;
349
350 KASSERT(queue != NULL, ("tq is NULL"));
351 TQ_ASSERT_LOCKED(queue);
352 tb.tb_running = NULL;
353 LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link);
354 in_net_epoch = false;
355
356 while ((gtask = STAILQ_FIRST(&queue->tq_queue)) != NULL) {
357 STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link);
358 gtask->ta_flags &= ~TASK_ENQUEUED;
359 tb.tb_running = gtask;
360 tb.tb_seq = ++queue->tq_seq;
361 TQ_UNLOCK(queue);
362
363 KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL"));
364 if (!in_net_epoch && TASK_IS_NET(gtask)) {
365 in_net_epoch = true;
366 NET_EPOCH_ENTER(et);
367 } else if (in_net_epoch && !TASK_IS_NET(gtask)) {
368 NET_EPOCH_EXIT(et);
369 in_net_epoch = false;
370 }
371 gtask->ta_func(gtask->ta_context);
372
373 TQ_LOCK(queue);
374 wakeup(gtask);
375 }
376 if (in_net_epoch)
377 NET_EPOCH_EXIT(et);
378 LIST_REMOVE(&tb, tb_link);
379}
380
381static int
382task_is_running(struct gtaskqueue *queue, struct gtask *gtask)

Callers 1

gtaskqueue_thread_loopFunction · 0.85

Calls 1

wakeupFunction · 0.70

Tested by

no test coverage detected