Added a timeout to event sleeper.