try to implement join
This commit is contained in:
@ -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
36
test/syscall_tests/join.c
Normal 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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user