diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-09-29 10:38:20 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-09-29 10:38:20 +0000 |
commit | 99eca1b2b31ae76556eb585849c14127b96ba97e (patch) | |
tree | 120767f4187cb64ac897dbabc88ae29b5ab333a8 /share | |
parent | c5072d5c9403487b92bc9f08357a9d002221f1ad (diff) | |
download | src-99eca1b2b31ae76556eb585849c14127b96ba97e.tar.gz src-99eca1b2b31ae76556eb585849c14127b96ba97e.zip |
While draining a timeout task prevent the taskqueue_enqueue_timeout()
function from restarting the timer.
Commonly taskqueue_enqueue_timeout() is called from within the task
function itself without any checks for teardown. Then it can happen
the timer stays active after the return of taskqueue_drain_timeout(),
because the timeout and task is drained separately.
This patch factors out the teardown flag into the timeout task itself,
allowing existing code to stay as-is instead of applying a teardown
flag to each and every of the timeout task consumers.
Add assert to taskqueue_drain_timeout() which prevents parallel
execution on the same timeout task.
Update manual page documenting the return value of
taskqueue_enqueue_timeout().
Differential Revision: https://reviews.freebsd.org/D8012
Reviewed by: kib, trasz
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=306441
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/taskqueue.9 | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9 index 5ee7fc8b36a4..2d39eee91796 100644 --- a/share/man/man9/taskqueue.9 +++ b/share/man/man9/taskqueue.9 @@ -223,6 +223,8 @@ Otherwise, the task is scheduled for enqueueing in the future, after the absolute value of .Va ticks is passed. +This function will return -1 if the queue is being drained. +Otherwise the number of pending calls will be returned. .Pp The .Fn taskqueue_cancel |