| 534 | } |
| 535 | |
| 536 | static void |
| 537 | gtaskqueue_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 | |
| 574 | static void |
| 575 | gtaskqueue_thread_enqueue(void *context) |
nothing calls this directly
no test coverage detected