X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Fthreads%2Fthread.c;h=ae92e1d646dc50d50ce02d26747ca12a8bd82236;hp=1e5a7d27179e928cb462a813200ed1a8518ccbf4;hb=6070611faac84bdf95c4405b3970c6928202f26b;hpb=39c5d0ad729238d08668ce0eeaa71bc25540bc7b diff --git a/src/threads/thread.c b/src/threads/thread.c index 1e5a7d2..ae92e1d 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -273,6 +273,31 @@ thread_yield (void) schedule (); intr_set_level (old_level); } + +/* Waits for the thread with the specified TID to terminate. If + TID has already terminated or TID does not refer to an + immediate child of the current thread, returns immediately. + + This function will be implemented in problem 1-2. For now, it + does nothing. */ +void +thread_join (tid_t child_tid UNUSED) +{ +} + +/* Sets the current thread's priority to NEW_PRIORITY. */ +void +thread_set_priority (int new_priority) +{ + thread_current ()->priority = new_priority; +} + +/* Returns the current thread's priority. */ +int +thread_get_priority (void) +{ + return thread_current ()->priority; +} /* Idle thread. Executes when no other thread is ready to run. */ static void