summaryrefslogtreecommitdiffstats
path: root/src/userprog/syscall.c
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-21 21:18:13 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-21 21:18:13 +0100
commitd33fe03b2fd2ba0fd559c52a1598593238767bbc (patch)
tree5393a28e53c3683d7c77bf76efaae19a4761db4f /src/userprog/syscall.c
parente40beeb936ff887afa9603c93aa804a4e5b4c7a9 (diff)
downloadpintos-d33fe03b2fd2ba0fd559c52a1598593238767bbc.tar.gz
free parent_child when possible
Diffstat (limited to 'src/userprog/syscall.c')
-rw-r--r--src/userprog/syscall.c10
1 files changed, 9 insertions, 1 deletions
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