add function of wait_pid