From 645eb22044ffa13d5de0294dc16c9c7aefa7c5b0 Mon Sep 17 00:00:00 2001 From: scottl Date: Sat, 14 Jan 2006 01:55:24 +0000 Subject: Add the following to the taskqueue api: taskqueue_start_threads(struct taskqueue **, int count, int pri, const char *name, ...); This allows the creation of 1 or more threads that will service a single taskqueue. Also rework the taskqueue_create() API to remove the API change that was introduced a while back. Creating a taskqueue doesn't rely on the presence of a process structure, and the proc mechanics are much better encapsulated in taskqueue_start_threads(). Also clean up the taskqueue_terminate() and taskqueue_free() functions to safely drain pending tasks and remove all associated threads. The TASKQUEUE_DEFINE and TASKQUEUE_DEFINE_THREAD macros have been changed to use the new API, but drivers compiled against the old definitions will still work. Thus, recompiling drivers is not a strict requirement. --- sys/dev/acpica/Osd/OsdSchedule.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'sys/dev/acpica/Osd') diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index f1e84e4..1e8aeca 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -65,31 +65,8 @@ struct acpi_task_ctx { void *at_context; }; -/* - * Private task queue definition for ACPI - */ -static struct proc * -acpi_task_start_threads(struct taskqueue **tqp) -{ - struct proc *acpi_kthread_proc; - int err, i; - - KASSERT(*tqp != NULL, ("acpi taskqueue not created before threads")); - - /* Start one or more threads to service our taskqueue. */ - for (i = 0; i < acpi_max_threads; i++) { - err = kthread_create(taskqueue_thread_loop, tqp, &acpi_kthread_proc, - 0, 0, "acpi_task%d", i); - if (err) { - printf("%s: kthread_create failed (%d)\n", __func__, err); - break; - } - } - return (acpi_kthread_proc); -} - TASKQUEUE_DEFINE(acpi, taskqueue_thread_enqueue, &taskqueue_acpi, - taskqueue_acpi_proc = acpi_task_start_threads(&taskqueue_acpi)); + taskqueue_start_threads(&taskqueue_acpi, 3, PWAIT, "acpi_task")); /* * Bounce through this wrapper function since ACPI-CA doesn't understand -- cgit v1.1