Fix join not working on join.c
This commit is contained in:
parent
a211e93905
commit
43f023e0b0
@ -34,7 +34,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")]
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user