From d33fe03b2fd2ba0fd559c52a1598593238767bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 21 Feb 2021 21:18:13 +0100 Subject: free parent_child when possible --- src/userprog/syscall.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/userprog/syscall.c') diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 0df46f4..177cf02 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -69,7 +69,7 @@ get_fd (struct thread *thread, int fd_i) } static void -exit (int status UNUSED) +exit (int status) { struct thread *thread = thread_current (); @@ -83,6 +83,14 @@ exit (int status UNUSED) } free (thread->fds); } + + lock_acquire (&thread->parent->l); + thread->parent->exit_status = status; + lock_release (&thread->parent->l); + + printf("%s: exit(%d)\n", thread->name, status); + + thread_exit (); } static int -- cgit v1.2.1