Skip to main content

available_parallelism

Function available_parallelism 

Source
pub fn available_parallelism() -> Result<NonZeroUsize, Arc<Error>>
Expand description

Returns the recommended amount of parallelism for the current process. Typically the number of available CPU cores.

This wraps std::thread::available_parallelism with a couple extras:

  • If the TURBO_TASKS_AVAILABLE_PARALLELISM env var is set, overrides the value. Panics if this env var fails to parse.
  • The resolved value is cached in a OnceLock