diff options
Diffstat (limited to 'kern/sched_prim.c')
-rw-r--r-- | kern/sched_prim.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kern/sched_prim.c b/kern/sched_prim.c index e8f260e..e354a21 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -458,6 +458,24 @@ void thread_sleep( } /* + * thread_sleep_lock: + * + * Cause the current thread to wait until the specified event + * occurs. The specified lock is unlocked before releasing + * the cpu. (This is a convenient way to sleep without manually + * calling assert_wait). + */ +void thread_sleep_lock( + event_t event, + lock_t lock, + boolean_t interruptible) +{ + assert_wait(event, interruptible); /* assert event */ + lock_done(lock); /* release the lock */ + thread_block((void (*)()) 0); /* block ourselves */ +} + +/* * thread_bind: * * Force a thread to execute on the specified processor. |