Add comparison function for thread list elements based on thread priority
This commit is contained in:
@@ -599,6 +599,17 @@ allocate_tid (void)
|
||||
return tid;
|
||||
}
|
||||
|
||||
/* Returns true iff the priority of the first list element's thread is greater
|
||||
than that of the second list element's thread. */
|
||||
bool
|
||||
thread_priority_greater (const struct list_elem *a, const struct list_elem *b,
|
||||
void *aux)
|
||||
{
|
||||
struct thread *ta = list_entry (a, struct thread, elem);
|
||||
struct thread *tb = list_entry (b, struct thread, elem);
|
||||
return ta->priority > tb->priority;
|
||||
}
|
||||
|
||||
/* Offset of `stack' member within `struct thread'.
|
||||
Used by switch.S, which can't figure it out on its own. */
|
||||
uint32_t thread_stack_ofs = offsetof (struct thread, stack);
|
||||
|
||||
Reference in New Issue
Block a user