summaryrefslogtreecommitdiffstats
path: root/threads/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'threads/thread.c')
-rw-r--r--threads/thread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/threads/thread.c b/threads/thread.c
index 17d21bd..a7db106 100644
--- a/threads/thread.c
+++ b/threads/thread.c
@@ -73,11 +73,11 @@ static tid_t allocate_tid (void);
73 73
74/* comparison function for our descending ordered ready list. */ 74/* comparison function for our descending ordered ready list. */
75bool 75bool
76priority_list_cmp_greater(const struct list_elem *a, const struct list_elem *b, 76thread_priority_cmp_greater(const struct list_elem *a, const struct list_elem *b,
77 void *AUX UNUSED) 77 void *AUX UNUSED)
78{ 78{
79 struct thread *t1 = list_entry (a, struct thread, elem); 79 const struct thread *t1 = list_entry (a, struct thread, elem);
80 struct thread *t2 = list_entry (b, struct thread, elem); 80 const struct thread *t2 = list_entry (b, struct thread, elem);
81 return (t1->priority > t2->priority); 81 return (t1->priority > t2->priority);
82} 82}
83 83
@@ -264,7 +264,7 @@ thread_unblock (struct thread *t)
264 old_level = intr_disable (); 264 old_level = intr_disable ();
265 ASSERT (t->status == THREAD_BLOCKED); 265 ASSERT (t->status == THREAD_BLOCKED);
266 /* add thread to our ordered ready_list */ 266 /* add thread to our ordered ready_list */
267 list_insert_ordered (&ready_list, &t->elem, &priority_list_cmp_greater, NULL); 267 list_insert_ordered (&ready_list, &t->elem, &thread_priority_cmp_greater, NULL);
268 t->status = THREAD_READY; 268 t->status = THREAD_READY;
269 intr_set_level (old_level); 269 intr_set_level (old_level);
270} 270}
@@ -335,7 +335,7 @@ thread_yield (void)
335 335
336 old_level = intr_disable (); 336 old_level = intr_disable ();
337 if (cur != idle_thread) 337 if (cur != idle_thread)
338 list_insert_ordered (&ready_list, &cur->elem, &priority_list_cmp_greater, NULL); 338 list_insert_ordered (&ready_list, &cur->elem, &thread_priority_cmp_greater, NULL);
339 cur->status = THREAD_READY; 339 cur->status = THREAD_READY;
340 schedule (); 340 schedule ();
341 intr_set_level (old_level); 341 intr_set_level (old_level);
@@ -390,7 +390,7 @@ thread_other_set_priority (struct thread *t, int new_priority)
390 { 390 {
391 /* sort our ordered list */ 391 /* sort our ordered list */
392 list_remove (&t->elem); 392 list_remove (&t->elem);
393 list_insert_ordered (&ready_list, &t->elem, &priority_list_cmp_greater, NULL); 393 list_insert_ordered (&ready_list, &t->elem, &thread_priority_cmp_greater, NULL);
394 } 394 }
395 else if (t->status == THREAD_RUNNING && !list_empty (&ready_list)) 395 else if (t->status == THREAD_RUNNING && !list_empty (&ready_list))
396 { 396 {