X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=solutions%2Fp1-2.patch;h=dfae038bbb4367526d07ebc9aaf5bd61c21f59de;hb=a9ca36e41805e259c2bfc238655a9586f7efb303;hp=7e3858281d98108f7386c4f916d5ede12826ec5b;hpb=096f7f960b7a6ae9659a37a80d5647557aa9aca8;p=pintos-anon diff --git a/solutions/p1-2.patch b/solutions/p1-2.patch index 7e38582..dfae038 100644 --- a/solutions/p1-2.patch +++ b/solutions/p1-2.patch @@ -112,13 +112,12 @@ diff -X pat -urpN src/threads/thread.c~ src/threads/thread.c schedule (); NOT_REACHED (); } -@@ -270,6 +290,22 @@ thread_block (void) - thread_current ()->status = THREAD_BLOCKED; - schedule (); - } -+ -+/* Waits for thread with tid CHILD_TID to die. */ -+void +@@ -283,8 +290,18 @@ thread_block (void) + This function will be implemented in problem 1-2. For now, it + does nothing. */ + void +-thread_join (tid_t child_tid UNUSED) +-{ +thread_join (tid_t child_tid) +{ + struct thread *cur = thread_current (); @@ -131,10 +130,9 @@ diff -X pat -urpN src/threads/thread.c~ src/threads/thread.c + if (child->tid == child_tid) + latch_acquire (&child->ready_to_die); + } -+} - - /* Idle thread. Executes when no other thread is ready to run. */ - static void + } + + /* Sets the current thread's priority to NEW_PRIORITY. */ @@ -335,6 +371,9 @@ init_thread (struct thread *t, const cha strlcpy (t->name, name, sizeof t->name); t->stack = (uint8_t *) t + PGSIZE;