def _try_acquire(self, blocking, watch, exclusive): try: gotten = self._trylock(self.lockfile, exclusive) except Exception as e: raise threading.ThreadError( "Unable to acquire lock on {} due to {}!".format(self.path, e)) if gotten: return True if not blocking or watch.expired(): return False raise _utils.RetryAgain()
def _try_acquire(self, blocking, watch): try: self.trylock() except IOError as e: if e.errno in (errno.EACCES, errno.EAGAIN): if not blocking or watch.expired(): return False else: raise _utils.RetryAgain() else: raise threading.ThreadError("Unable to acquire lock on" " `%(path)s` due to" " %(exception)s" % { 'path': self.path, 'exception': e, }) else: return True