Fix join not working on join.c

This commit is contained in:
Quentin Legot 2023-05-04 22:19:00 +02:00 committed by François Autin
parent c6f5818059
commit 9bd0ef02aa
2 changed files with 13 additions and 23 deletions

View File

@ -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")]

View File

@ -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;
}