Add comparison function for thread list elements based on thread priority

This commit is contained in:
Themis Demetriades
2024-10-15 11:50:04 +01:00
parent 4ed64cf173
commit 1821d73b09
2 changed files with 14 additions and 0 deletions

View File

@@ -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);