1
0
forked from bot/app
LiteyukiBot/docs/dev/api/core/manager.md

104 lines
1.9 KiB
Markdown
Raw Normal View History

2024-08-19 09:43:46 +08:00
---
title: liteyuki.core.manager
order: 1
icon: laptop-code
category: API
---
### ***def*** `start(self: Any, name: str) -> None`
开启后自动监控进程,并添加到进程字典中
Args:
name:
Returns:
### ***def*** `start_all(self: Any) -> None`
启动所有进程
### ***def*** `add_target(self: Any, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
添加进程
Args:
name: 进程名,用于获取和唯一标识
target: 进程函数
args: 进程函数参数
kwargs: 进程函数关键字参数通常会默认传入chan_active和chan_passive
### ***def*** `join_all(self: Any) -> None`
### ***def*** `terminate(self: Any, name: str) -> None`
终止进程并从进程字典中删除
Args:
name:
Returns:
### ***def*** `terminate_all(self: Any) -> None`
### ***def*** `is_process_alive(self: Any, name: str) -> bool`
检查进程是否存活
Args:
name:
Returns:
### ***class*** `ChannelDeliver`
### ***class*** `ProcessManager`
进程管理器
####   ***def*** `start(self: Any, name: str) -> None`
开启后自动监控进程,并添加到进程字典中
Args:
name:
Returns:
####   ***def*** `start_all(self: Any) -> None`
启动所有进程
####   ***def*** `add_target(self: Any, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
添加进程
Args:
name: 进程名,用于获取和唯一标识
target: 进程函数
args: 进程函数参数
kwargs: 进程函数关键字参数通常会默认传入chan_active和chan_passive
####   ***def*** `join_all(self: Any) -> None`
####   ***def*** `terminate(self: Any, name: str) -> None`
终止进程并从进程字典中删除
Args:
name:
Returns:
####   ***def*** `terminate_all(self: Any) -> None`
####   ***def*** `is_process_alive(self: Any, name: str) -> bool`
检查进程是否存活
Args:
name:
Returns: