process removal: remove a few bugs and race conditions

This commit is contained in:
Matheus
2022-10-08 22:03:46 -03:00
parent a17630acb7
commit 0bd861c19f
3 changed files with 18 additions and 17 deletions
+10 -2
View File
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <kernel/event.h>
#include <kernel/alloc.h>
#include <arch/interrupt.h>
void syscall_exit(int status){
proc_t* proc = arch_getcls()->thread->proc;
@@ -44,10 +45,17 @@ void syscall_exit(int status){
}
spinlock_release(&init->lock);
spinlock_release(&proc->lock);
event_signal(&proc->parent->childevent, true);
// context and thread destruction will happen in the waitpid()
// the pointer to this thread will reside in proc->threads
proc->threads = arch_getcls()->thread;
arch_interrupt_disable();
spinlock_release(&proc->lock);
sched_dequeue();
__builtin_unreachable();