Permalink
Browse files

needed updates

  • Loading branch information...
1 parent 3063806 commit af5607f10a2e99e659771995a617e1e52e97f643 @grantborthwick committed Oct 28, 2012
Showing with 5 additions and 5 deletions.
  1. +4 −5 src/userprog/process.c
  2. +1 −0 src/userprog/syscall.c
View
@@ -139,17 +139,16 @@ release_child (struct wait_status *cs)
int
process_wait (tid_t child_tid)
{
- while(1){}
struct list_elem * e;
- struct thread * t = NULL;
+ struct wait_status * t = NULL;
struct thread * cur = thread_current();
for (e = list_begin (&cur->children); e != list_end (&cur->children);e = list_next (e)){
- struct thread * t2 = list_entry (e, struct thread, allelem);
+ struct wait_status * t2 = list_entry (e, struct wait_status, elem);
if (t2->tid == child_tid){t = t2; break;}
}
if (t == NULL){return -1;}
- sema_down(&(t->wait_status->dead));
- return -1;
+ sema_down(&(t->dead));
+ return 0;
}
/* Free the current process's resources. */
View
@@ -184,6 +184,7 @@ static int
sys_exit (int exit_code)
{
thread_current ()->wait_status->exit_code = exit_code;
+ sema_up(&(thread_current ()->wait_status->dead));
thread_exit ();
NOT_REACHED ();
}

0 comments on commit af5607f

Please sign in to comment.