diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 01:46:53 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-08-15 12:43:26 +0200 |
commit | a645fbf233963cf7efa11fe36f00f93dec03ca6b (patch) | |
tree | 6ac71aa66c8825a0b5b050c84a3afb6173efbbe8 /kern/sched_prim.c | |
parent | fb7b9e5893a98cc41c6769383fe4bc4dbcc121e5 (diff) |
kern: new function `thread_sleep_lock'
* kern/sched_prim.c (thread_sleep_lock): New function.
* kern/sched_prim.h (thread_sleep_lock): New delcaration.
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. |