Protobuf prototype

This commit is contained in:
Konstantin Lampalzer 2022-03-18 18:11:16 +01:00
parent e277a83c5f
commit 9b567b8c6c
119 changed files with 8599 additions and 0 deletions

25
client_s1/compLib/Lock.py Normal file
View file

@ -0,0 +1,25 @@
from filelock import FileLock, Timeout
import atexit
FILELOCK_PATH = "/root/complib.lock"
global_lock = FileLock(FILELOCK_PATH, timeout=1)
class Lock(object):
@staticmethod
def lock():
global_lock.acquire()
@staticmethod
def unlock():
global_lock.release()
@staticmethod
def is_locked():
try:
global_lock.acquire()
global_lock.release()
return False
except Timeout:
return True
atexit.register(Lock.unlock)