How to time out an infinite loop in 60 seconds?