Date: Sun, 20 Nov 2011 08:29:23 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r227748 - head/sys/kern Message-ID: <201111200829.pAK8TNm7082615@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sun Nov 20 08:29:23 2011 New Revision: 227748 URL: http://svn.freebsd.org/changeset/base/227748 Log: Minor style change: Simplify the description of pause() and shorten the KASSERT message in pause. Also add a clamp for the timo argument in the non-KASSERT case. Suggested by: Bruce Evans MFC after: 1 week Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Sun Nov 20 05:32:12 2011 (r227747) +++ head/sys/kern/kern_synch.c Sun Nov 20 08:29:23 2011 (r227748) @@ -325,25 +325,24 @@ msleep_spin(void *ident, struct mtx *mtx } /* - * pause() is almost like tsleep() except that the intention is to not - * be explicitly woken up by another thread. Instead, the current - * thread simply wishes to sleep until the timeout expires. It is - * implemented using a dummy wait channel. During cold bootup pause() - * will use the DELAY() function instead of tsleep() to wait the given - * number of system ticks. The passed "timo" argument must not be - * negative and also greater than zero. + * pause() delays the calling thread by the given number of system ticks. + * During cold bootup, pause() uses the DELAY() function instead of + * the tsleep() function to do the waiting. The "timo" argument must be + * greater than zero. */ int pause(const char *wmesg, int timo) { + KASSERT(timo > 0, ("pause: timo must be > 0")); - KASSERT(timo > 0, ("pause: a positive and non-zero " - "timeout is required")); + /* silently convert invalid timeouts */ + if (timo < 1) + timo = 1; if (cold) { /* * We delay one HZ at a time to avoid overflowing the - * DELAY() argument: + * system specific DELAY() function(s): */ while (timo >= hz) { DELAY(1000000);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111200829.pAK8TNm7082615>