Implement taskqueue_poll_is_busy() for use by the LinuxKPI.
Refer to comment above function for a detailed description. Discussed with: kib @ MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
aa7ab7b7d4
commit
df21508671
@ -487,6 +487,23 @@ task_is_running(struct taskqueue *queue, struct task *task)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Only use this function in single threaded contexts. It returns
|
||||
* non-zero if the given task is either pending or running. Else the
|
||||
* task is idle and can be queued again or freed.
|
||||
*/
|
||||
int
|
||||
taskqueue_poll_is_busy(struct taskqueue *queue, struct task *task)
|
||||
{
|
||||
int retval;
|
||||
|
||||
TQ_LOCK(queue);
|
||||
retval = task->ta_pending > 0 || task_is_running(queue, task);
|
||||
TQ_UNLOCK(queue);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static int
|
||||
taskqueue_cancel_locked(struct taskqueue *queue, struct task *task,
|
||||
u_int *pendp)
|
||||
|
@ -79,6 +79,7 @@ int taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
|
||||
int taskqueue_enqueue(struct taskqueue *queue, struct task *task);
|
||||
int taskqueue_enqueue_timeout(struct taskqueue *queue,
|
||||
struct timeout_task *timeout_task, int ticks);
|
||||
int taskqueue_poll_is_busy(struct taskqueue *queue, struct task *task);
|
||||
int taskqueue_cancel(struct taskqueue *queue, struct task *task,
|
||||
u_int *pendp);
|
||||
int taskqueue_cancel_timeout(struct taskqueue *queue,
|
||||
|
Loading…
Reference in New Issue
Block a user