MFC r196358:
Remove unused taskqueue_find() function. Reviewed by: dfr Approved by: re (kib)
This commit is contained in:
parent
856d08a08d
commit
65536ad653
@ -28,7 +28,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 17, 2009
|
||||
.Dd August 18, 2009
|
||||
.Dt TASKQUEUE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -59,8 +59,6 @@ struct task {
|
||||
.Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
|
||||
.Ft void
|
||||
.Fn taskqueue_free "struct taskqueue *queue"
|
||||
.Ft struct taskqueue *
|
||||
.Fn taskqueue_find "const char *name"
|
||||
.Ft int
|
||||
.Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
|
||||
.Ft int
|
||||
@ -115,16 +113,10 @@ should be used in place of
|
||||
.Pp
|
||||
The function
|
||||
.Fn taskqueue_free
|
||||
should be used to remove the queue from the global list of queues
|
||||
and free the memory used by the queue.
|
||||
should be used to free the memory used by the queue.
|
||||
Any tasks that are on the queue will be executed at this time after
|
||||
which the thread servicing the queue will be signaled that it should exit.
|
||||
.Pp
|
||||
The system maintains a list of all queues which can be searched using
|
||||
.Fn taskqueue_find .
|
||||
The first queue whose name matches is returned, otherwise
|
||||
.Dv NULL .
|
||||
.Pp
|
||||
To add a task to the list of tasks queued on a taskqueue, call
|
||||
.Fn taskqueue_enqueue
|
||||
with pointers to the queue and task.
|
||||
|
@ -45,11 +45,8 @@ __FBSDID("$FreeBSD$");
|
||||
static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
|
||||
static void *taskqueue_giant_ih;
|
||||
static void *taskqueue_ih;
|
||||
static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues;
|
||||
static struct mtx taskqueue_queues_mutex;
|
||||
|
||||
struct taskqueue {
|
||||
STAILQ_ENTRY(taskqueue) tq_link;
|
||||
STAILQ_HEAD(, task) tq_queue;
|
||||
const char *tq_name;
|
||||
taskqueue_enqueue_fn tq_enqueue;
|
||||
@ -84,8 +81,6 @@ TQ_UNLOCK(struct taskqueue *tq)
|
||||
mtx_unlock(&tq->tq_mutex);
|
||||
}
|
||||
|
||||
static void init_taskqueue_list(void *data);
|
||||
|
||||
static __inline int
|
||||
TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm,
|
||||
int t)
|
||||
@ -95,16 +90,6 @@ TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm,
|
||||
return (msleep(p, m, pri, wm, t));
|
||||
}
|
||||
|
||||
static void
|
||||
init_taskqueue_list(void *data __unused)
|
||||
{
|
||||
|
||||
mtx_init(&taskqueue_queues_mutex, "taskqueue list", NULL, MTX_DEF);
|
||||
STAILQ_INIT(&taskqueue_queues);
|
||||
}
|
||||
SYSINIT(taskqueue_list, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_taskqueue_list,
|
||||
NULL);
|
||||
|
||||
static struct taskqueue *
|
||||
_taskqueue_create(const char *name, int mflags,
|
||||
taskqueue_enqueue_fn enqueue, void *context,
|
||||
@ -124,10 +109,6 @@ _taskqueue_create(const char *name, int mflags,
|
||||
queue->tq_flags |= TQ_FLAGS_ACTIVE;
|
||||
mtx_init(&queue->tq_mutex, mtxname, NULL, mtxflags);
|
||||
|
||||
mtx_lock(&taskqueue_queues_mutex);
|
||||
STAILQ_INSERT_TAIL(&taskqueue_queues, queue, tq_link);
|
||||
mtx_unlock(&taskqueue_queues_mutex);
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
@ -156,10 +137,6 @@ void
|
||||
taskqueue_free(struct taskqueue *queue)
|
||||
{
|
||||
|
||||
mtx_lock(&taskqueue_queues_mutex);
|
||||
STAILQ_REMOVE(&taskqueue_queues, queue, taskqueue, tq_link);
|
||||
mtx_unlock(&taskqueue_queues_mutex);
|
||||
|
||||
TQ_LOCK(queue);
|
||||
queue->tq_flags &= ~TQ_FLAGS_ACTIVE;
|
||||
taskqueue_run(queue);
|
||||
@ -169,26 +146,6 @@ taskqueue_free(struct taskqueue *queue)
|
||||
free(queue, M_TASKQUEUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns with the taskqueue locked.
|
||||
*/
|
||||
struct taskqueue *
|
||||
taskqueue_find(const char *name)
|
||||
{
|
||||
struct taskqueue *queue;
|
||||
|
||||
mtx_lock(&taskqueue_queues_mutex);
|
||||
STAILQ_FOREACH(queue, &taskqueue_queues, tq_link) {
|
||||
if (strcmp(queue->tq_name, name) == 0) {
|
||||
TQ_LOCK(queue);
|
||||
mtx_unlock(&taskqueue_queues_mutex);
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
mtx_unlock(&taskqueue_queues_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
taskqueue_enqueue(struct taskqueue *queue, struct task *task)
|
||||
{
|
||||
|
@ -48,7 +48,6 @@ struct thread;
|
||||
*/
|
||||
typedef void (*taskqueue_enqueue_fn)(void *context);
|
||||
|
||||
struct proc;
|
||||
struct taskqueue *taskqueue_create(const char *name, int mflags,
|
||||
taskqueue_enqueue_fn enqueue,
|
||||
void *context);
|
||||
@ -56,7 +55,6 @@ int taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
|
||||
const char *name, ...) __printflike(4, 5);
|
||||
int taskqueue_enqueue(struct taskqueue *queue, struct task *task);
|
||||
void taskqueue_drain(struct taskqueue *queue, struct task *task);
|
||||
struct taskqueue *taskqueue_find(const char *name);
|
||||
void taskqueue_free(struct taskqueue *queue);
|
||||
void taskqueue_run(struct taskqueue *queue);
|
||||
void taskqueue_block(struct taskqueue *queue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user