Surrounds block with calls to enter and exit, throwing an exception from newTimeoutException if a timeout occurred.