Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Nov 2015 02:11:02 +0300
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Randall Stewart <rrs@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r290805 - in head: share/man/man9 sys/kern sys/net sys/netinet sys/netinet6 sys/netpfil/pf
Message-ID:  <20151113231102.GG73031@FreeBSD.org>
In-Reply-To: <201511132251.tADMpa8o053824@repo.freebsd.org>
References:  <201511132251.tADMpa8o053824@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  Randall,

On Fri, Nov 13, 2015 at 10:51:36PM +0000, Randall Stewart wrote:
R> Author: rrs
R> Date: Fri Nov 13 22:51:35 2015
R> New Revision: 290805
R> URL: https://svnweb.freebsd.org/changeset/base/290805
R> 
R> Log:
R>   This fixes several places where callout_stops return is examined. The
R>   new return codes of -1 were mistakenly being considered "true". Callout_stop
R>   now returns -1 to indicate the callout had either already completed or
R>   was not running and 0 to indicate it could not be stopped.  Also update
R>   the manual page to make it more consistent no non-zero in the callout_stop
R>   or callout_reset descriptions.

What about making callout_stop() return value a enum?

enum {
	NOTRUN = 1,
	COMPLETED,
	RUNNING,
	PENDING,
};

Will make code more comprehendable, than now:

	pending = !!(callout_stop(&timeout_task->c) > 0);

will be

	pending = callout_stop(&timeout_task->c) >= RUNNING;

-- 
Totus tuus, Glebius.



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