Pavel, Steve Version 3: - Add a timeout argument to the wait function and abort with -EAGAIN upon timeout.