Lines Matching refs:task

59 	struct task	*tb_running;
63 struct task * const TB_DRAIN_WAITER = (struct task *)0x1;
66 STAILQ_HEAD(, task) tq_queue;
219 taskqueue_enqueue_locked(struct taskqueue *queue, struct task *task) in taskqueue_enqueue_locked() argument
221 struct task *ins; in taskqueue_enqueue_locked()
222 struct task *prev; in taskqueue_enqueue_locked()
224 KASSERT(task->ta_func != NULL, ("enqueueing task with NULL func")); in taskqueue_enqueue_locked()
228 if (task->ta_pending) { in taskqueue_enqueue_locked()
229 if (task->ta_pending < USHRT_MAX) in taskqueue_enqueue_locked()
230 task->ta_pending++; in taskqueue_enqueue_locked()
238 prev = STAILQ_LAST(&queue->tq_queue, task, ta_link); in taskqueue_enqueue_locked()
239 if (!prev || prev->ta_priority >= task->ta_priority) { in taskqueue_enqueue_locked()
240 STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link); in taskqueue_enqueue_locked()
245 if (ins->ta_priority < task->ta_priority) in taskqueue_enqueue_locked()
249 STAILQ_INSERT_AFTER(&queue->tq_queue, prev, task, ta_link); in taskqueue_enqueue_locked()
251 STAILQ_INSERT_HEAD(&queue->tq_queue, task, ta_link); in taskqueue_enqueue_locked()
254 task->ta_pending = 1; in taskqueue_enqueue_locked()
267 taskqueue_enqueue(struct taskqueue *queue, struct task *task) in taskqueue_enqueue() argument
272 res = taskqueue_enqueue_locked(queue, task); in taskqueue_enqueue()
352 struct task t_barrier; in taskqueue_drain_tq_queue()
444 struct task *task; in taskqueue_run_locked() local
458 task = STAILQ_FIRST(&queue->tq_queue); in taskqueue_run_locked()
459 KASSERT(task != NULL, ("task is NULL")); in taskqueue_run_locked()
461 pending = task->ta_pending; in taskqueue_run_locked()
462 task->ta_pending = 0; in taskqueue_run_locked()
463 tb.tb_running = task; in taskqueue_run_locked()
466 KASSERT(task->ta_func != NULL, ("task->ta_func is NULL")); in taskqueue_run_locked()
467 task->ta_func(task->ta_context, pending); in taskqueue_run_locked()
471 wakeup(task); in taskqueue_run_locked()
491 task_is_running(struct taskqueue *queue, struct task *task) in task_is_running() argument
497 if (tb->tb_running == task) in task_is_running()
509 taskqueue_poll_is_busy(struct taskqueue *queue, struct task *task) in taskqueue_poll_is_busy() argument
514 retval = task->ta_pending > 0 || task_is_running(queue, task); in taskqueue_poll_is_busy()
521 taskqueue_cancel_locked(struct taskqueue *queue, struct task *task, in taskqueue_cancel_locked() argument
525 if (task->ta_pending > 0) in taskqueue_cancel_locked()
526 STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); in taskqueue_cancel_locked()
528 *pendp = task->ta_pending; in taskqueue_cancel_locked()
529 task->ta_pending = 0; in taskqueue_cancel_locked()
530 return (task_is_running(queue, task) ? EBUSY : 0); in taskqueue_cancel_locked()
534 taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp) in taskqueue_cancel() argument
539 error = taskqueue_cancel_locked(queue, task, pendp); in taskqueue_cancel()
567 taskqueue_drain(struct taskqueue *queue, struct task *task) in taskqueue_drain() argument
574 while (task->ta_pending != 0 || task_is_running(queue, task)) in taskqueue_drain()
575 TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0); in taskqueue_drain()