From 0ed2f796d7723af8321f35d4ef5e6781ea41e36d Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 18 Aug 2022 14:11:31 +0200 Subject: syscall/fork: FORK_SHAREMEM for primitive "threads" --- src/user/lib/thread.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/user/lib/thread.c (limited to 'src/user/lib/thread.c') diff --git a/src/user/lib/thread.c b/src/user/lib/thread.c new file mode 100644 index 0000000..25d98a9 --- /dev/null +++ b/src/user/lib/thread.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +void thread_create(int flags, void (*fn)(void*), void *arg) { + if (!_syscall_fork(flags | FORK_SHAREMEM, NULL)) { + void *stack = malloc(4096); + chstack(arg, fn, stack + 4096); + } +} -- cgit v1.2.3