Beispiel #1
0
 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
Beispiel #2
0
 def _try_lock(self):
     return LockFile(self.lock_file)