Avoid infinite loop around timed condition variable