From 9bd0ef02aaed8b7e3995cc6d7d71552361ce6028 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Thu, 4 May 2023 22:19:00 +0200 Subject: [PATCH] Fix join not working on join.c --- src/main.rs | 2 +- test/syscall_tests/join.c | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4b701dc..5ff4398 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,7 +35,7 @@ struct Args { /// 1 to enable machine debug, /// 2 to enable system debug, /// 3 to enable all debug - #[arg(short, long, value_parser = clap::value_parser!(u8).range(0..=3))] + #[arg(short, long, value_parser = clap::value_parser!(u8).range(0..=3), default_value_t = 0)] debug: u8, /// Path to the executable binary file to execute #[arg(short = 'x', long, value_name = "PATH")] diff --git a/test/syscall_tests/join.c b/test/syscall_tests/join.c index 8d26596..2466066 100644 --- a/test/syscall_tests/join.c +++ b/test/syscall_tests/join.c @@ -1,36 +1,26 @@ #include "userlib/syscall.h" #include "userlib/libnachos.h" - -const int N = 3; -int iplein = 0; -int ivide = 0; -int tab[3]; -SemId svide; -SemId splein; - -void th1(); - -void th2(); - -int main() { - ThreadId th1 = threadCreate("th1", th1); - ThreadId th2 = threadCreate("th2", th2); - Join(th1); - Join(th2); - return 0; -} - -void th1() { +void thread1() { for(int i = 0; i < 10; i++) { n_printf("Hello from th1\n"); } } -void th2() { +void thread2() { for(int i = 0; i < 10; i++) { n_printf("Hello from th2\n"); } } + + +int main() { + ThreadId th1 = threadCreate("thread 1", thread1); + ThreadId th2 = threadCreate("thread 2", thread2); + Join(th1); + Join(th2); + Shutdown(); + return 0; +}