Do not try lock in an infinite loop