Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Need to mark processes finished after we get their parent, or we migh…
Browse files Browse the repository at this point in the history
…t lose the process object...
  • Loading branch information
klange committed May 23, 2021
1 parent 39a22a0 commit fddd9d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/sys/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,6 @@ process_t * process_get_parent(process_t * process) {

void task_exit(int retval) {
this_core->current_process->status = retval;
__sync_or_and_fetch(&this_core->current_process->flags, PROC_FLAG_FINISHED);
list_free(this_core->current_process->wait_queue);
free(this_core->current_process->wait_queue);
list_free(this_core->current_process->signal_queue);
Expand Down Expand Up @@ -1048,6 +1047,8 @@ void task_exit(int retval) {
}

process_t * parent = process_get_parent((process_t *)this_core->current_process);
__sync_or_and_fetch(&this_core->current_process->flags, PROC_FLAG_FINISHED);

if (parent && !(parent->flags & PROC_FLAG_FINISHED)) {
send_signal(parent->group, SIGCHLD, 1);
wakeup_queue(parent->wait_queue);
Expand Down

0 comments on commit fddd9d7

Please sign in to comment.