Stage2: multiple user threads based on uniprocessor, see new added test race_adder and threads.

This commit is contained in:
Yifan Wu 2021-10-02 16:18:05 -07:00
parent 4fa4e9cab4
commit a341b338c8
12 changed files with 254 additions and 57 deletions

View file

@ -106,3 +106,14 @@ pub fn sleep(period_ms: usize) {
sys_yield();
}
}
pub fn thread_create(entry: usize) -> isize { sys_thread_create(entry) }
pub fn gettid() -> isize { sys_gettid() }
pub fn waittid(tid: usize) -> isize {
loop {
match sys_waittid(tid) {
-2 => { yield_(); }
exit_code => return exit_code,
}
}
}