class_docstr: File lock based on Windows-only msvcrt module.
      
class_docstr_tok: ["File","lock","based","on","Windows-only","msvcrt","module","."]
code: def acquire(self, blocking=False):
      import msvcrt  # @UnresolvedImport
  
      flags = os.O_CREAT | os.O_WRONLY
      mode = msvcrt.LK_NBLCK
      if blocking:
          mode = msvcrt.LK_LOCK
  
      self.fd = os.open(self.filename, flags)
      try:
          msvcrt.locking(self.fd, mode, 1)
          return True
      except IOError:
          e = sys.exc_info()[1]
          if e.errno not in (errno.EAGAIN, errno.EACCES, errno.EDEADLK):
              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 MsvcrtLock obj's underlying member method code with example usage: obj.acquire(blocking) and returns: True, False