Moved the code for priority donation to thread.c and modified the thread struct to have an element that checks if we need to reset the priority