python 锁 装饰器
锁 装饰器
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