def _try_lock(self): tries = 0 i = random.randint(0, self.n-1) while True: tries += 1 try: return LockFile(self.lock_file + str(i)) except LockError: if tries >= self.n: raise i = (i+1) % self.n
def _try_lock(self): return LockFile(self.lock_file)