next_thread_to_run returns thread with highest priority