Merge recent update from ch7 && cargo clippy

This commit is contained in:
Yifan Wu 2022-01-22 12:32:36 -08:00
parent 737340b0a0
commit c9583b0f53
20 changed files with 236 additions and 163 deletions

View file

@ -6,7 +6,7 @@ extern crate user_lib;
extern crate alloc;
use user_lib::{thread_create, waittid, exit};
use alloc::vec::Vec;
use alloc::vec;
pub fn thread_a() -> ! {
for _ in 0..1000 { print!("a"); }
@ -25,10 +25,11 @@ pub fn thread_c() -> ! {
#[no_mangle]
pub fn main() -> i32 {
let mut v = Vec::new();
v.push(thread_create(thread_a as usize, 0));
v.push(thread_create(thread_b as usize, 0));
v.push(thread_create(thread_c as usize, 0));
let v = vec![
thread_create(thread_a as usize, 0),
thread_create(thread_b as usize, 0),
thread_create(thread_c as usize, 0),
];
for tid in v.iter() {
let exit_code = waittid(*tid as usize);
println!("thread#{} exited with code {}", tid, exit_code);