struct ThreadPool
XuAPI
pub struct ThreadPool {
}用途
Pool 连接池管理器,并发安全地维护和调度复用套接字连接。
公开字段
此类型没有公开字段。
#sync/pool标准库包 `#sync/pool`。
struct ThreadPoolpub struct ThreadPool {
}Pool 连接池管理器,并发安全地维护和调度复用套接字连接。
此类型没有公开字段。
cpu_countpub fn cpu_count() int执行 cpu count 操作。
无需传入参数。
int — 该类型的值
empty_thread_poolpub fn empty_thread_pool() ThreadPool执行 empty thread pool 操作。
无需传入参数。
ThreadPool — 该类型的值
new_thread_poolpub fn new_thread_pool(num_threads int) ThreadPool构造 thread pool。
num_threads intThreadPool — 该类型的值
(&ThreadPool) num_threadspub fn (p &ThreadPool) num_threads() int&ThreadPool 上的操作:执行 num threads 操作。
p &ThreadPoolThreadPool 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
($&ThreadPool) closepub fn (p $&ThreadPool) close()$&ThreadPool 上的操作:关闭资源。
p $&ThreadPoolThreadPool 实例;以独占借用传入,方法可修改它,调用方仍持有实例。不返回值。
max_procspub fn max_procs() int执行 max procs 操作。
无需传入参数。
int — 该类型的值
set_max_procspub fn set_max_procs(nprocs int) int设置 max procs。
nprocs intint — 该类型的值
stop_schedulerpub fn stop_scheduler()执行 stop scheduler 操作。
无需传入参数。
不返回值。