Fixed ready deletion bug in thread_set_pri