Single thread support (#4988)

This commit is contained in:
Sébastien d'Herbais de Thun 2024-09-26 11:02:44 +02:00 committed by GitHub
parent 59d65bbdc0
commit 8d38bd4066
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -225,7 +225,7 @@ pub struct SharedArgs {
pub package_storage_args: PackageStorageArgs, pub package_storage_args: PackageStorageArgs,
/// Number of parallel jobs spawned during compilation, /// Number of parallel jobs spawned during compilation,
/// defaults to number of CPUs. /// defaults to number of CPUs. Setting it to 1 disables parallelism.
#[clap(long, short)] #[clap(long, short)]
pub jobs: Option<usize>, pub jobs: Option<usize>,
} }

View File

@ -60,7 +60,11 @@ impl SystemWorld {
pub fn new(command: &SharedArgs) -> Result<Self, WorldCreationError> { pub fn new(command: &SharedArgs) -> Result<Self, WorldCreationError> {
// Set up the thread pool. // Set up the thread pool.
if let Some(jobs) = command.jobs { if let Some(jobs) = command.jobs {
rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global().ok(); rayon::ThreadPoolBuilder::new()
.num_threads(jobs)
.use_current_thread()
.build_global()
.ok();
} }
// Resolve the system-global input path. // Resolve the system-global input path.