Fix. Implement `wait` method based on `select` function.