Skip to content

Commit

Permalink
syscalls: unblock threads when a signal is raised
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 20, 2024
1 parent de03547 commit 9c4716f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/syscalls/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <platform/context.h>
#include <kernel/syscalls.h>
#include <kernel/sched.h>
#include <kernel/signal.h>
#include <kernel/logger.h>

static SyscallRequest *requests = NULL; // sort of a linked list in a sense
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9c4716f

Please sign in to comment.