Implement sleep using blocking & BinaryHeap.
This commit is contained in:
parent
db6a93e60d
commit
c951c1781e
6 changed files with 79 additions and 7 deletions
|
@ -5,6 +5,7 @@ const SYSCALL_PIPE: usize = 59;
|
|||
const SYSCALL_READ: usize = 63;
|
||||
const SYSCALL_WRITE: usize = 64;
|
||||
const SYSCALL_EXIT: usize = 93;
|
||||
const SYSCALL_SLEEP: usize = 101;
|
||||
const SYSCALL_YIELD: usize = 124;
|
||||
const SYSCALL_GET_TIME: usize = 169;
|
||||
const SYSCALL_GETPID: usize = 172;
|
||||
|
@ -61,6 +62,10 @@ pub fn sys_exit(exit_code: i32) -> ! {
|
|||
panic!("sys_exit never returns!");
|
||||
}
|
||||
|
||||
pub fn sys_sleep(sleep_ms: usize) -> isize {
|
||||
syscall(SYSCALL_SLEEP, [sleep_ms, 0, 0])
|
||||
}
|
||||
|
||||
pub fn sys_yield() -> isize {
|
||||
syscall(SYSCALL_YIELD, [0, 0, 0])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue