Implemented the function for time-out.