thread waitting and get return value