Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2012 00:54:49 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r243850 - stable/9/sys/kern
Message-ID:  <201212040054.qB40snD5001979@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Dec  4 00:54:49 2012
New Revision: 243850
URL: http://svnweb.freebsd.org/changeset/base/243850

Log:
  MFC r243341:
  Add a special meaning to the negative ticks argument for
  taskqueue_enqueue_timeout().  Do not rearm the callout if it is
  already armed and the ticks is negative.  Otherwise rearm it to fire
  in abs(ticks) ticks in the future.

Modified:
  stable/9/sys/kern/subr_taskqueue.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_taskqueue.c
==============================================================================
--- stable/9/sys/kern/subr_taskqueue.c	Tue Dec  4 00:53:20 2012	(r243849)
+++ stable/9/sys/kern/subr_taskqueue.c	Tue Dec  4 00:54:49 2012	(r243850)
@@ -252,9 +252,13 @@ taskqueue_enqueue_timeout(struct taskque
 		} else {
 			queue->tq_callouts++;
 			timeout_task->f |= DT_CALLOUT_ARMED;
+			if (ticks < 0)
+				ticks = -ticks; /* Ignore overflow. */
+		}
+		if (ticks > 0) {
+			callout_reset(&timeout_task->c, ticks,
+			    taskqueue_timeout_func, timeout_task);
 		}
-		callout_reset(&timeout_task->c, ticks, taskqueue_timeout_func,
-		    timeout_task);
 	}
 	TQ_UNLOCK(queue);
 	return (res);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212040054.qB40snD5001979>