Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jul 2016 10:27:43 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r302426 - in projects/hps_head: share/man/man9 sys/kern
Message-ID:  <201607081027.u68ARhZh025725@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Jul  8 10:27:43 2016
New Revision: 302426
URL: https://svnweb.freebsd.org/changeset/base/302426

Log:
  Update the callout_stop() return values as done by r302350 and update
  the timeout(9) manual page.
  
  Differential Revision:	https://reviews.freebsd.org/D7042

Modified:
  projects/hps_head/share/man/man9/timeout.9
  projects/hps_head/sys/kern/kern_timeout.c

Modified: projects/hps_head/share/man/man9/timeout.9
==============================================================================
--- projects/hps_head/share/man/man9/timeout.9	Fri Jul  8 10:06:02 2016	(r302425)
+++ projects/hps_head/share/man/man9/timeout.9	Fri Jul  8 10:27:43 2016	(r302426)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 3, 2015
+.Dd July 8, 2015
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
@@ -312,6 +312,15 @@ This function returns either
 .Dv CALLOUT_RET_CANCELLED
 or
 .Dv CALLOUT_RET_DRAINING .
+If the callout was scheduled regardless of being serviced or not,
+.Dv CALLOUT_RET_CANCELLED
+is returned.
+If the callout was stopped and is still being serviced
+.Dv CALLOUT_RET_DRAINING
+is returned.
+If the callout was stopped and is no longer being serviced
+.Dv CALLOUT_RET_STOPPED
+is returned.
 If a lock is associated with the callout given by the
 .Fa c
 argument and it is exclusivly locked when this function is called, this
@@ -546,12 +555,22 @@ is undefined.
 This function is used to stop a timeout function invocation associated with the callout pointed to by the
 .Fa c
 argument, in a non-blocking fashion.
-This function can be called multiple times in a row with no side effects, even if the callout is already stopped. This function however should not be called before the callout has been initialized.
+This function can be called multiple times in a row with no side effects, even if the callout is already stopped.
+This function however should not be called before the callout has been initialized.
 This function returns either
 .Dv CALLOUT_RET_STOPPED ,
 .Dv CALLOUT_RET_CANCELLED
 or
 .Dv CALLOUT_RET_DRAINING .
+If the callout is being serviced regardless of being scheduled or not,
+.Dv CALLOUT_RET_DRAINING
+is returned.
+If the callout is not being serviced and was already stopped
+.Dv CALLOUT_RET_STOPPED
+is returned.
+If the callout is not being serviced and was scheduled
+.Dv CALLOUT_RET_CANCELLED
+is returned.
 If a lock is associated with the callout given by the
 .Fa c
 argument and it is exclusivly locked when this function is called, the

Modified: projects/hps_head/sys/kern/kern_timeout.c
==============================================================================
--- projects/hps_head/sys/kern/kern_timeout.c	Fri Jul  8 10:06:02 2016	(r302425)
+++ projects/hps_head/sys/kern/kern_timeout.c	Fri Jul  8 10:27:43 2016	(r302426)
@@ -1036,7 +1036,10 @@ callout_restart_async(struct callout *c,
 		} else if (cc_exec_cancel(cc, direct) == false ||
 		    cc_exec_restart(cc, direct) == true) {
 			cc_exec_cancel(cc, direct) = true;
-			retval = CALLOUT_RET_CANCELLED;
+			if (coa != NULL)
+				retval = CALLOUT_RET_CANCELLED;
+			else
+				retval = CALLOUT_RET_DRAINING;
 		} else {
 			retval = CALLOUT_RET_DRAINING;
 		}



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