How to use the portalocker.LOCK_UN function in portalocker

To help you get started, we’ve selected a few portalocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thought-machine / please / tools / please_pex / pex / View on Github external
def pex_lockfile(basepath, uniquedir):
        # Acquire the lockfile.
        lockfile_path = os.path.join(basepath, '.lock-%s' % uniquedir)
        lockfile = open(lockfile_path, "a+")
        # Block until we can acquire the lockfile.
        portalocker.lock(lockfile, portalocker.LOCK_EX)
        yield lockfile
        portalocker.lock(lockfile, portalocker.LOCK_UN)
github webrecorder / pywb / pywb / recorder / View on Github external
def _close_file(self, fh):
            if != 'nt':
                portalocker.lock(fh, portalocker.LOCK_UN)
            return True
        except Exception as e:
            return False
github awslabs / sockeye / sockeye / View on Github external
def __exit__(self, exc_type, exc_val, exc_tb):
        if self.gpu_id is not None:
  "Releasing GPU {}.".format(self.gpu_id))
        if self.lock_file is not None:
            if self._acquired_lock:
                portalocker.lock(self.lock_file, portalocker.LOCK_UN)