summaryrefslogtreecommitdiffstats
path: root/share/man/man9/taskqueue.9
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2010-11-08 20:56:31 +0000
committermdf <mdf@FreeBSD.org>2010-11-08 20:56:31 +0000
commitccbc087adcaa5186934ad911d3211084206d74b7 (patch)
tree899d8e0d6f17680a9b78254843161a1ae057db95 /share/man/man9/taskqueue.9
parenta7f4df4adcea44a13eeff6b3875d05d1b421d80c (diff)
downloadFreeBSD-src-ccbc087adcaa5186934ad911d3211084206d74b7.zip
FreeBSD-src-ccbc087adcaa5186934ad911d3211084206d74b7.tar.gz
Add a taskqueue_cancel(9) to cancel a pending task without waiting for
it to run as taskqueue_drain(9) does. Requested by: hselasky Original code: jeff Reviewed by: jhb MFC after: 2 weeks
Diffstat (limited to 'share/man/man9/taskqueue.9')
-rw-r--r--share/man/man9/taskqueue.927
1 files changed, 27 insertions, 0 deletions
diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9
index d5e096a..168ca70 100644
--- a/share/man/man9/taskqueue.9
+++ b/share/man/man9/taskqueue.9
@@ -63,6 +63,8 @@ struct task {
.Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
.Ft int
.Fn taskqueue_enqueue_fast "struct taskqueue *queue" "struct task *task"
+.Ft int
+.Fn taskqueue_cancel "struct taskqueue *queue" "struct task *task" "u_int *pendp"
.Ft void
.Fn taskqueue_drain "struct taskqueue *queue" "struct task *task"
.Ft int
@@ -162,6 +164,31 @@ is called on the task pointer passed to
.Fn taskqueue_enqueue .
.Pp
The
+.Fn taskqueue_cancel
+function is used to cancel a task.
+The
+.Va ta_pending
+count is cleared, and the old value returned in the reference
+parameter
+.Fa pendp ,
+if it is non- Dv NULL .
+If the task is currently running,
+.Dv EBUSY
+is returned, otherwise 0.
+To implement a blocking
+.Fn taskqueue_cancel
+that waits for a running task to finish, it could look like:
+.Bd -literal -offset indent
+while (taskqueue_cancel(tq, task, NULL) != 0)
+ taskqueue_drain(tq, task);
+.Ed
+.Pp
+Note that, as with
+.Fn taskqueue_drain ,
+the caller is responsible for ensuring that the task is not re-enqueued
+after being canceled.
+.Pp
+The
.Fn taskqueue_drain
function is used to wait for the task to finish.
There is no guarantee that the task will not be
OpenPOWER on IntegriCloud