voicevox / voicevox_engine /utility /mutex_utility.py
2ndelement's picture
init
f1f433f
raw
history blame contribute delete
280 Bytes
import threading
def mutex_wrapper(lock: threading.Lock):
def wrap(f):
def func(*args, **kw):
lock.acquire()
try:
return f(*args, **kw)
finally:
lock.release()
return func
return wrap