opsicommon.system.posix package

Module contents

This file is part of opsi - https://www.opsi.org

opsicommon.system.posix.lock_file(file, exclusive=False, timeout=5.0)

An exclusive or write lock gives a process exclusive access for writing to the specified part of the file. While a write lock is in place, no other process can lock that part of the file. A shared or read lock prohibits any other process from requesting a write lock on the file.

Parameters:
  • file (TextIO | BinaryIO | IO) –

  • exclusive (bool) –

  • timeout (float) –

Return type:

Generator[None, None, None]