HomeVyOS Platform

locking: T6544: Added locking util

Description

locking: T6544: Added locking util

Sometimes we need a reliable way to lock an execution until some other operation
is not done.

This commit introduces locking util, which can be used as a common lock, even
between different processes.

Usage example:

from vyos.utils.locking import Lock

lock = Lock('my_lock_id')
lock.acquire(timeout=10)

print(f'Lock acquired: {lock.is_locked}')

lock.release()

Details

Provenance
zsdcAuthored on Jul 3 2024, 7:45 PM
Parents
rVYOSONEX2eb80002145b: Merge pull request #3769 from vyos/T6546-add-permission-unused-check
Branches
Loading...
Tags
Loading...