Skip to main content

set_kernel_threads

Function set_kernel_threads 

Source
pub fn set_kernel_threads(n: i32)
Expand description

Process-global interpreter worker-thread count (src/interp/parallel.cpp:16, one std::atomic<int>; setter at :24).

A free function, never a ScriptBuilder method, because there is one setting per process and it changes timing, never values — nobody should be able to write builder.threads(4) and expect isolation.

Rust-specific footgun: a program already running rayon at num_cpus that also calls set_kernel_threads(num_cpus) oversubscribes multiplicatively, and the symptom is a slowdown with no error anywhere (hazard 8).