mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-06 20:42:52 +08:00
15 lines
328 B
Python
15 lines
328 B
Python
import threading
|
|
from typing import Any, Callable
|
|
|
|
|
|
class SerialTaskExecutor:
|
|
def __init__(self):
|
|
self._lock = threading.Lock()
|
|
|
|
def run(self, fn: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
|
|
with self._lock:
|
|
return fn(*args, **kwargs)
|
|
|
|
|
|
task_serial_executor = SerialTaskExecutor()
|