Fix the race condition of thread::_trigger