mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 13:48:21 +00:00
process removal: remove a few bugs and race conditions
This commit is contained in:
+10
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user