Lines Matching refs:tq
74 #define TQ_LOCK(tq) \
76 if ((tq)->tq_spin) \
77 mtx_lock_spin(&(tq)->tq_mutex); \
79 mtx_lock(&(tq)->tq_mutex); \
82 #define TQ_UNLOCK(tq) \
84 if ((tq)->tq_spin) \
85 mtx_unlock_spin(&(tq)->tq_mutex); \
87 mtx_unlock(&(tq)->tq_mutex); \
102 TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm,
105 if (tq->tq_spin)
144 taskqueue_terminate(struct thread **pp, struct taskqueue *tq)
147 while (tq->tq_tcount > 0 || tq->tq_callouts > 0) {
148 wakeup(tq);
149 TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0);
471 struct taskqueue *tq;
478 tq = *tqp;
484 tq->tq_threads = malloc(sizeof(struct thread *) * count, M_TASKQUEUE,
486 if (tq->tq_threads == NULL) {
494 &tq->tq_threads[i], RFSTOPPED, 0, "%s", ktname);
497 &tq->tq_threads[i], RFSTOPPED, 0,
503 tq->tq_threads[i] = NULL; /* paranoid */
505 tq->tq_tcount++;
508 if (tq->tq_threads[i] == NULL)
510 td = tq->tq_threads[i];
523 struct taskqueue **tqp, *tq;
526 tq = *tqp;
527 TQ_LOCK(tq);
528 while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
529 taskqueue_run_locked(tq);
535 if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0)
537 TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0);
539 taskqueue_run_locked(tq);
542 tq->tq_tcount--;
543 wakeup_one(tq->tq_threads);
544 TQ_UNLOCK(tq);
551 struct taskqueue **tqp, *tq;
554 tq = *tqp;
556 mtx_assert(&tq->tq_mutex, MA_OWNED);
557 wakeup_one(tq);