def acquire(self, blocking=False):
        import fcntl
        self.fd = os.open(self.filename, os.O_CREAT | os.O_WRONLY)
        mode = fcntl.LOCK_EX
        if not blocking: mode |= fcntl.LOCK_NB
        try:
            fcntl.flock(self.fd, mode)
            self.locked = True
            return True
        except __HOLE__, e:
            if e.errno not in (errno.EAGAIN, errno.EACCES):
                raise
            return False
dataset/ETHPy150Open dokipen/whoosh/src/whoosh/support/filelock.py/FcntlLock.acquire