Handle 0 usec in rendez_sleep_timeout()
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 8 Oct 2015 15:03:23 +0000 (11:03 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 14 Oct 2015 22:43:53 +0000 (18:43 -0400)
Userspace can ask for 0 sec, so an assert is wrong.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/rendez.c

index 8499ca3..c2b3e87 100644 (file)
@@ -67,7 +67,8 @@ void rendez_sleep_timeout(struct rendez *rv, int (*cond)(void*), void *arg,
        struct cv_lookup_elm cle;
        struct timer_chain *pcpui_tchain = &per_cpu_info[core_id()].tchain;
 
-       assert(usec > 0);
+       if (!usec)
+               return;
        /* Doing this cond check early, but then unlocking again.  Mostly just to
         * avoid weird issues with the CV lock and the alarm tchain lock. */
        cv_lock_irqsave(&rv->cv, &irq_state);