struct ThreadPool
pub struct ThreadPool {
}Purpose
Pool Connection pool manager scheduling reusable socket connections.
Public fields
This type has no public fields.
#sync/poolBounded OS-thread worker pool over pthread + hardware atomics for parallel CPU kernels. Workers never mutate runtime/core allocator or FFI symbol caches: all C symbols are resolved on the creating thread and passed directly via function pointers inside the C state block.
struct ThreadPoolpub struct ThreadPool {
}Pool Connection pool manager scheduling reusable socket connections.
This type has no public fields.
cpu_countpub fn cpu_count() intQuery online OS hardware threads (clamped to [1, 256]); 1 on unsupported OS.
No arguments are required.
int — a value of this type
empty_thread_poolpub fn empty_thread_pool() ThreadPoolEmpty thread pool.
No arguments are required.
ThreadPool — a value of this type
new_thread_poolpub fn new_thread_pool(num_threads int) ThreadPoolConstruct thread pool.
num_threads intThreadPool — a value of this type
(&ThreadPool) num_threadspub fn (p &ThreadPool) num_threads() intOperation on &ThreadPool: num threads.
p &ThreadPoolThreadPool instance used by this call (borrow).int — a value of this type
($&ThreadPool) closepub fn (p $&ThreadPool) close()Operation on $&ThreadPool: close the resource.
p $&ThreadPoolThreadPool instance used by this call (exclusive borrow).This call does not return a value.
max_procspub fn max_procs() intCurrent maximum number of OS threads executing xu green threads.
No arguments are required.
int — a value of this type
set_max_procspub fn set_max_procs(nprocs int) intEnable M:N work-sharing execution of xu green threads across n OS threads. When n <= 0, honors XU_PROCS if set, otherwise uses cpu_count.
nprocs intint — a value of this type
stop_schedulerpub fn stop_scheduler()Gracefully stop and join background M:N worker OS threads.
No arguments are required.
This call does not return a value.