锁 装饰器
from threading import Lock
signal_lock = Lock()
def send_signal_lock(func):
def inner(*args,**kwargs):
signal_lock.acquire()
res = func(*args,**kwargs)
signal_lock.release()
return res
return inner
2023-11-24 08:16:58
锁 装饰器
from threading import Lock
signal_lock = Lock()
def send_signal_lock(func):
def inner(*args,**kwargs):
signal_lock.acquire()
res = func(*args,**kwargs)
signal_lock.release()
return res
return inner