Implements a timeout