From f8621bacc21736e4d816e8060d6fde54dc99b436 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 14 Apr 2024 19:11:39 -0300 Subject: [PATCH] newthread: fix tid and runningthreadcount --- kernel-src/sys/syscalls/newthread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel-src/sys/syscalls/newthread.c b/kernel-src/sys/syscalls/newthread.c index d43f0dc7..c0e4d10a 100644 --- a/kernel-src/sys/syscalls/newthread.c +++ b/kernel-src/sys/syscalls/newthread.c @@ -55,6 +55,11 @@ syscallret_t syscall_newthread(context_t *, void *entry, void *stack) { proc->threads[i]->vmmctx = _cpu()->thread->vmmctx; + ret.errno = 0; + ret.ret = proc->threads[i]->tid; + + __atomic_fetch_add(&proc->runningthreadcount, 1, __ATOMIC_SEQ_CST); + sched_queue(proc->threads[i]); cleanup: