BurritOS/test/syscall_tests/join.c

27 lines
451 B
C
Raw Normal View History

2023-04-23 15:11:06 +02:00
#include "userlib/syscall.h"
#include "userlib/libnachos.h"
2023-05-04 22:19:00 +02:00
void thread1() {
2023-04-23 15:11:06 +02:00
for(int i = 0; i < 10; i++)
{
n_printf("Hello from th1\n");
}
}
2023-05-04 22:19:00 +02:00
void thread2() {
2023-04-23 15:11:06 +02:00
for(int i = 0; i < 10; i++)
{
n_printf("Hello from th2\n");
}
}
2023-05-04 22:19:00 +02:00
int main() {
ThreadId th1 = threadCreate("thread 1", thread1);
ThreadId th2 = threadCreate("thread 2", thread2);
Join(th1);
Join(th2);
Shutdown();
return 0;
}