try to implement join

This commit is contained in:
Quentin Legot
2023-04-23 15:11:06 +02:00
committed by François Autin
parent 31f1e760e9
commit c6f5818059
8 changed files with 79 additions and 31 deletions

View File

@ -1,4 +1,4 @@
PROGRAMS = halt.guac prints.guac producteur_consommateur.guac
PROGRAMS = halt.guac prints.guac producteur_consommateur.guac join.guac
TOPDIR = ../..
include $(TOPDIR)/Makefile.rules

36
test/syscall_tests/join.c Normal file
View File

@ -0,0 +1,36 @@
#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() {
for(int i = 0; i < 10; i++)
{
n_printf("Hello from th1\n");
}
}
void th2() {
for(int i = 0; i < 10; i++)
{
n_printf("Hello from th2\n");
}
}