Skip to content

Commit

Permalink
ipc: maintain sender thread in kill()
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 26, 2024
1 parent bc4bc29 commit 1ba84b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ipc/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ int kill(Thread *t, pid_t pid, int sig) {
if(!s) return -ENOMEM;

s->signum = sig;
s->sender = t;
s->next = NULL;

acquireLockBlocking(&dest->lock);
Expand Down Expand Up @@ -262,6 +263,7 @@ void signalHandle(Thread *t) {
struct sigaction *handlers = (struct sigaction *) t->signals;
uintptr_t handler = (uintptr_t) handlers[signum].sa_handler;
int def = 0;
Thread *sender = s->sender;

free(s);

Expand All @@ -284,8 +286,6 @@ void signalHandle(Thread *t) {
terminateThread(t, -1, true);
break;
default:
// TODO: execute the custom signal handler here
KERROR("TODO: execute custom signal handler: handler = %X, def = %d\n", handler, def);
for(;;);
}
}
Expand Down

0 comments on commit 1ba84b1

Please sign in to comment.