From 6f8712d0d09d03bcc3d6d5e6cc8fa1402d851314 Mon Sep 17 00:00:00 2001 From: Godmar Back Date: Wed, 27 Aug 2008 17:04:08 +0000 Subject: [PATCH] update for thread_foreach patch --- solutions/p2.patch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/solutions/p2.patch b/solutions/p2.patch index 4c2660e..c6d9a42 100644 --- a/solutions/p2.patch +++ b/solutions/p2.patch @@ -10,12 +10,10 @@ diff -u src/threads/thread.c~ src/threads/thread.c #endif /* Random value for struct thread's `magic' member. -@@ -251,16 +252,19 @@ thread_tid (void) +@@ -251,18 +252,19 @@ thread_tid (void) void thread_exit (void) { -+ struct thread *t = thread_current (); -+ ASSERT (!intr_context ()); #ifdef USERPROG @@ -24,11 +22,12 @@ diff -u src/threads/thread.c~ src/threads/thread.c - + syscall_exit (); + - /* Just set our status to dying and schedule another process. - We will be destroyed during the call to schedule_tail(). */ + /* Remove thread from all threads list, set our status to dying, + and schedule another process. That process will destroy us + when it call schedule_tail(). */ intr_disable (); -- thread_current ()->status = THREAD_DYING; -+ t->status = THREAD_DYING; + list_remove (&thread_current()->allelem); + thread_current ()->status = THREAD_DYING; schedule (); NOT_REACHED (); } -- 2.30.2