diff --git a/Cargo.lock b/Cargo.lock index 204b8216..f5d228ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1257,7 +1257,6 @@ dependencies = [ "melib", "nix", "notify-rust", - "num_cpus", "pcre2", "proc-macro2", "quote", @@ -1445,16 +1444,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.2", - "libc", -] - [[package]] name = "numtoa" version = "0.1.0" diff --git a/meli/Cargo.toml b/meli/Cargo.toml index ba6f18c6..7fcd1b04 100644 --- a/meli/Cargo.toml +++ b/meli/Cargo.toml @@ -33,7 +33,6 @@ libz-sys = { version = "1.1", features = ["static"], optional = true } linkify = { version = "^0.10", default-features = false } melib = { path = "../melib", version = "0.8.5-rc.3", features = [] } nix = { version = "0.27", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] } -num_cpus = "1.12.0" serde = "1.0.71" serde_derive = "1.0.71" serde_json = "1.0" diff --git a/meli/src/jobs.rs b/meli/src/jobs.rs index aecc6452..922d94e8 100644 --- a/meli/src/jobs.rs +++ b/meli/src/jobs.rs @@ -185,7 +185,10 @@ impl JobExecutor { jobs: Arc::new(Mutex::new(IndexMap::default())), }; let mut workers = vec![]; - for _ in 0..num_cpus::get().max(1) { + for _ in 0..std::thread::available_parallelism() + .map(Into::into) + .unwrap_or(1) + { let new_worker = Worker::new_fifo(); ret.workers.push(new_worker.stealer()); let p = Parker::new();