summaryrefslogtreecommitdiff
path: root/src/user/lib/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/thread.c')
-rw-r--r--src/user/lib/thread.c11
1 files changed, 11 insertions, 0 deletions
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 <camellia/flags.h>
+#include <camellia/syscalls.h>
+#include <stdlib.h>
+#include <user/lib/thread.h>
+
+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);
+ }
+}