summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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