wait with return value