Esempio n. 1
0
 def trylock(self):
     if lock._host is None:
         lock._host = socket.gethostname()
     lockname = '%s:%s' % (lock._host, os.getpid())
     while not self.held:
         try:
             util.makelock(lockname, self.f)
             self.held = 1
         except (OSError, IOError), why:
             if why.errno == errno.EEXIST:
                 locker = self.testlock()
                 if locker is not None:
                     raise LockHeld(errno.EAGAIN, self.f, self.desc,
                                    locker)
             else:
                 raise LockUnavailable(why.errno, why.strerror,
                                       why.filename, self.desc)
Esempio n. 2
0
 def makelock(self, info, path):
     return util.makelock(info, self.join(path))
Esempio n. 3
0
 def makelock(self, info, path):
     return util.makelock(info, self.join(path))