| 801 | } |
| 802 | |
| 803 | void |
| 804 | taskqueue_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 | |
| 841 | void |
| 842 | taskqueue_thread_enqueue(void *context) |
nothing calls this directly
no test coverage detected