class_docstr: File lock based on UNIX-only fcntl module.
      
class_docstr_tok: ["File","lock","based","on","UNIX-only","fcntl","module","."]
code: def acquire(self, blocking=False):
      import fcntl  # @UnresolvedImport
  
      flags = os.O_CREAT | os.O_WRONLY
      self.fd = os.open(self.filename, flags)
  
      mode = fcntl.LOCK_EX
      if not blocking:
          mode |= fcntl.LOCK_NB
  
      try:
          fcntl.flock(self.fd, mode)
          self.locked = True
          return True
      except IOError:
          e = sys.exc_info()[1]
          if e.errno not in (errno.EAGAIN, errno.EACCES):
              raise
          os.close(self.fd)
          self.fd = None
          return False
  
file_path: whoosh/src/whoosh/util/filelock.py
imports: import errno
  import os
  import sys
  import time
label_desc: Use image node_id 1 for calling the FcntlLock obj's underlying member method code with example usage: obj.acquire(blocking) and returns: True, False