remove thread_was_interrupted and fix wait_internal pending issue.