gem5.utils.filelock module

class gem5.utils.filelock.FileLock(file_name, timeout=10, delay=0.05)

Bases: object

A file locking mechanism that has context-manager support so you can use it in a with statement. This should be relatively cross compatible as it doesn’t rely on msvcrt or fcntl for the locking.

acquire()

Acquire the lock, if possible. If the lock is in use, it check again every wait seconds. It does this until it either gets the lock or exceeds timeout number of seconds, in which case it throws an exception.

release()

Get rid of the lock by deleting the lockfile.

When working in a with statement, this gets automatically called at the end.

exception gem5.utils.filelock.FileLockException

Bases: Exception