diff options
author | dzwdz | 2022-08-18 14:11:31 +0200 |
---|---|---|
committer | dzwdz | 2022-08-18 14:11:31 +0200 |
commit | 0ed2f796d7723af8321f35d4ef5e6781ea41e36d (patch) | |
tree | c4b64981d0d2bfddd597eb05e84cd1a781d253e1 /src/user/app/tests/kernel | |
parent | 7a3f292c8316239182f30fa8f3a5e5a14cca587c (diff) |
syscall/fork: FORK_SHAREMEM for primitive "threads"
Diffstat (limited to 'src/user/app/tests/kernel')
-rw-r--r-- | src/user/app/tests/kernel/threads.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/user/app/tests/kernel/threads.c b/src/user/app/tests/kernel/threads.c new file mode 100644 index 0000000..9f08c39 --- /dev/null +++ b/src/user/app/tests/kernel/threads.c @@ -0,0 +1,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); +} |