Permalink
Browse files

pre yield

  • Loading branch information...
1 parent d1b10d5 commit 6977b0bd1564f5cc59db1171dc9f14b47e9e6dc9 @grantborthwick committed Oct 4, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 src/threads/thread.c
  2. +3 −3 src/threads/thread.c~
View
@@ -252,8 +252,8 @@ thread_unblock (struct thread *t)
list_push_back (&ready_list, &t->elem);
t->status = THREAD_READY;
printf("(%s - %d, %s - %d)",(thread_current ()->name), (thread_current ()->priority),(t->name),(t->priority));
- if ((thread_current ()->priority) < (t->priority)){/*printf(" => Should yield.\n");*/ /*thread_yield();*/ /*printf("Back.\n");*/}
- else{/*printf(" => Did not yield\n");*/}
+ if ((thread_current () == idle_thread) || (thread_current ()->priority) < (t->priority)){printf(" => Should yield.\n"); /*thread_yield();*/ /*printf("Back.\n");*/}
+ else{printf(" => Did not yield\n");}
/*struct list_elem* e;
struct list_elem* u;
struct thread* e2;
View
@@ -251,9 +251,9 @@ thread_unblock (struct thread *t)
ASSERT (t->status == THREAD_BLOCKED);
list_push_back (&ready_list, &t->elem);
t->status = THREAD_READY;
- //printf("(%s - %d, %s - %d)",(thread_current ()->name), (thread_current ()->priority),(t->name),(t->priority));
- if ((thread_current ()->priority) < (t->priority)){/*printf(" => Should yield.\n");*/ /*thread_yield();*/ /*printf("Back.\n");*/}
- else{/*printf(" => Did not yield\n");*/}
+ printf("(%s - %d, %s - %d)",(thread_current ()->name), (thread_current ()->priority),(t->name),(t->priority));
+ if ((thread_current ()->priority) < (t->priority)){printf(" => Should yield.\n"); /*thread_yield();*/ /*printf("Back.\n");*/}
+ else{printf(" => Did not yield\n");}
/*struct list_elem* e;
struct list_elem* u;
struct thread* e2;

0 comments on commit 6977b0b

Please sign in to comment.