Implement sleep using blocking & BinaryHeap.
This commit is contained in:
parent
db6a93e60d
commit
c951c1781e
6 changed files with 79 additions and 7 deletions
|
@ -100,11 +100,8 @@ pub fn waitpid(pid: usize, exit_code: &mut i32) -> isize {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn sleep(period_ms: usize) {
|
||||
let start = sys_get_time();
|
||||
while sys_get_time() < start + period_ms as isize {
|
||||
sys_yield();
|
||||
}
|
||||
pub fn sleep(sleep_ms: usize) {
|
||||
sys_sleep(sleep_ms);
|
||||
}
|
||||
|
||||
pub fn thread_create(entry: usize) -> isize { sys_thread_create(entry) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue