blob: 9f08c399c7a9b481267da0d29d5294f84081a3f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "../tests.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <user/lib/esemaphore.h>
#include <user/lib/thread.h>
int global_n;
static void basic_thread(void *sem) {
global_n = 10;
esem_signal(sem);
}
static void test_basic_thread(void) {
struct evil_sem *sem = esem_new(0);
global_n = 0;
thread_create(FORK_NOREAP, basic_thread, sem);
esem_wait(sem);
test(global_n == 10);
}
void r_k_threads(void) {
run_test(test_basic_thread);
}
|