Merge recent update from ch7 && cargo clippy
This commit is contained in:
parent
737340b0a0
commit
c9583b0f53
20 changed files with 236 additions and 163 deletions
|
@ -9,7 +9,7 @@ extern crate alloc;
|
|||
use user_lib::{semaphore_create, semaphore_up, semaphore_down};
|
||||
use user_lib::{thread_create, waittid, sleep};
|
||||
use user_lib::exit;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::vec;
|
||||
|
||||
const SEM_SYNC: usize = 0;
|
||||
|
||||
|
@ -33,9 +33,10 @@ pub fn main() -> i32 {
|
|||
// create semaphores
|
||||
assert_eq!(semaphore_create(0) as usize, SEM_SYNC);
|
||||
// create threads
|
||||
let mut threads = Vec::new();
|
||||
threads.push(thread_create(first as usize, 0));
|
||||
threads.push(thread_create(second as usize, 0));
|
||||
let threads = vec![
|
||||
thread_create(first as usize, 0),
|
||||
thread_create(second as usize, 0),
|
||||
];
|
||||
// wait for all threads to complete
|
||||
for thread in threads.iter() {
|
||||
waittid(*thread as usize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue