diff options
author | Ian Lepore <ian@FreeBSD.org> | 2017-07-31 00:54:50 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2017-07-31 00:54:50 +0000 |
commit | f37b7fc2d40a3d953bc12aa81d2ce68945bc1742 (patch) | |
tree | 7a77033518e83ff8c46a2c18752cdd6e2ebce24d /sys/kern/subr_taskqueue.c | |
parent | b618318ae3f742965217ba720d2dbf80f2ce1f7b (diff) | |
download | src-f37b7fc2d40a3d953bc12aa81d2ce68945bc1742.tar.gz src-f37b7fc2d40a3d953bc12aa81d2ce68945bc1742.zip |
Notes
Diffstat (limited to 'sys/kern/subr_taskqueue.c')
-rw-r--r-- | sys/kern/subr_taskqueue.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index 5d43ac6ca94c..0ec519df0d46 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -289,8 +289,8 @@ taskqueue_timeout_func(void *arg) } int -taskqueue_enqueue_timeout(struct taskqueue *queue, - struct timeout_task *timeout_task, int ticks) +taskqueue_enqueue_timeout_sbt(struct taskqueue *queue, + struct timeout_task *timeout_task, sbintime_t sbt, sbintime_t pr, int flags) { int res; @@ -304,7 +304,7 @@ taskqueue_enqueue_timeout(struct taskqueue *queue, /* Do nothing */ TQ_UNLOCK(queue); res = -1; - } else if (ticks == 0) { + } else if (sbt == 0) { taskqueue_enqueue_locked(queue, &timeout_task->t); /* The lock is released inside. */ } else { @@ -313,18 +313,27 @@ taskqueue_enqueue_timeout(struct taskqueue *queue, } else { queue->tq_callouts++; timeout_task->f |= DT_CALLOUT_ARMED; - if (ticks < 0) - ticks = -ticks; /* Ignore overflow. */ + if (sbt < 0) + sbt = -sbt; /* Ignore overflow. */ } - if (ticks > 0) { - callout_reset(&timeout_task->c, ticks, - taskqueue_timeout_func, timeout_task); + if (sbt > 0) { + callout_reset_sbt(&timeout_task->c, sbt, pr, + taskqueue_timeout_func, timeout_task, flags); } TQ_UNLOCK(queue); } return (res); } +int +taskqueue_enqueue_timeout(struct taskqueue *queue, + struct timeout_task *ttask, int ticks) +{ + + return (taskqueue_enqueue_timeout_sbt(queue, ttask, ticks * tick_sbt, + 0, 0)); +} + static void taskqueue_task_nop_fn(void *context, int pending) { |