X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=solutions%2Fp1-2.patch;h=a2a040d45f5504a02eb15627c552982e9bfa501f;hb=6e7aa139f24e1f1ac10713348be27cd47b97c31e;hp=a5e743f0e61aaf5cf45c907e56ccb3c86bae8218;hpb=8a8db36c5a9ca4d8a8c7323105328beb57a6ae75;p=pintos-anon diff --git a/solutions/p1-2.patch b/solutions/p1-2.patch index a5e743f..a2a040d 100644 --- a/solutions/p1-2.patch +++ b/solutions/p1-2.patch @@ -81,7 +81,7 @@ diff -X pat -urpN pintos.orig/src/threads/thread.c pintos/src/threads/thread.c thread_exit (void) { + struct thread *t = thread_current (); -+ list_elem *e; ++ list_elem *e, *next; + ASSERT (!intr_context ()); @@ -93,10 +93,10 @@ diff -X pat -urpN pintos.orig/src/threads/thread.c pintos/src/threads/thread.c + latch_release (&t->ready_to_die); + + /* Notify our children that they can die. */ -+ for (e = list_begin (&t->children); e != list_end (&t->children); -+ e = list_next (e)) ++ for (e = list_begin (&t->children); e != list_end (&t->children); e = next) + { + struct thread *child = list_entry (e, struct thread, children_elem); ++ next = list_next (e); + list_remove (e); + sema_up (&child->can_die); + }