mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 20:17:39 +08:00
✨ 新增线程安全共享内存储存器(注释)
This commit is contained in:
parent
1b692dd13f
commit
ff585ac7c2
@ -4,16 +4,19 @@
|
||||
"""
|
||||
|
||||
import threading
|
||||
from typing import Any, Optional
|
||||
from typing import Optional
|
||||
|
||||
from liteyuki.utils import IS_MAIN_PROCESS
|
||||
from liteyuki.comm.channel import Channel
|
||||
from liteyuki.utils import IS_MAIN_PROCESS
|
||||
|
||||
if IS_MAIN_PROCESS:
|
||||
_locks = {}
|
||||
|
||||
|
||||
def _get_lock(key):
|
||||
def _get_lock(key) -> threading.Lock:
|
||||
"""
|
||||
获取锁
|
||||
"""
|
||||
if IS_MAIN_PROCESS:
|
||||
if key not in _locks:
|
||||
_locks[key] = threading.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user