summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-11-20 08:29:23 +0000
committerhselasky <hselasky@FreeBSD.org>2011-11-20 08:29:23 +0000
commit09cd8e0f19bf4fcfad118fb28224debba62b5ad6 (patch)
treee91dd8dea5532e50113eec344cf6c7541f9d76e7 /sys/kern/kern_synch.c
parent1c7932d8700beaf35065d777ce68888c107cb24a (diff)
downloadFreeBSD-src-09cd8e0f19bf4fcfad118fb28224debba62b5ad6.zip
FreeBSD-src-09cd8e0f19bf4fcfad118fb28224debba62b5ad6.tar.gz
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
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f4a8494..3565b04 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -325,25 +325,24 @@ msleep_spin(void *ident, struct mtx *mtx, const char *wmesg, int timo)
}
/*
- * 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);
OpenPOWER on IntegriCloud