From 9c4716fedb0258298e52d545454a5c4afb38c70a Mon Sep 17 00:00:00 2001 From: jewelcodes Date: Wed, 20 Nov 2024 15:30:34 -0500 Subject: [PATCH] syscalls: unblock threads when a signal is raised --- src/syscalls/queue.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/syscalls/queue.c b/src/syscalls/queue.c index 33b06e3..4a7df54 100644 --- a/src/syscalls/queue.c +++ b/src/syscalls/queue.c @@ -9,6 +9,7 @@ #include #include #include +#include #include static SyscallRequest *requests = NULL; // sort of a linked list in a sense @@ -118,10 +119,17 @@ int syscallProcess() { terminateThread(syscall->thread, -1, false); schedRelease(); } else { - threadUseContext(syscall->thread->tid); - syscallDispatchTable[syscall->function](syscall); - platformSetContextStatus(syscall->thread->context, syscall->ret); - //threadUseContext(getTid()); + signalHandle(syscall->thread); + if(syscall->thread->status == THREAD_ZOMBIE) { + setLocalSched(true); + return 1; + } else if(syscall->thread->status == THREAD_QUEUED) { + syscallEnqueue(syscall); + } else if(syscall->thread->status == THREAD_BLOCKED) { + threadUseContext(syscall->thread->tid); + syscallDispatchTable[syscall->function](syscall); + platformSetContextStatus(syscall->thread->context, syscall->ret); + } } if((syscall->thread->status == THREAD_BLOCKED) && syscall->unblock) {