diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 3b53331..54638d1 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.59.0] + rust: [nightly, beta, stable, 1.49.0] steps: - uses: actions/checkout@v2 diff --git a/Cargo.toml b/Cargo.toml index 407b3dd..490b4da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "async-global-executor" -version = "2.1.0" +version = "2.2.0" authors = ["Marc-Antoine Perennou "] description = "A global executor built on top of async-executor and async-io" -edition = "2021" +edition = "2018" license = "Apache-2.0 OR MIT" repository = "https://github.com/Keruspe/async-global-executor" homepage = "https://github.com/Keruspe/async-global-executor" @@ -11,7 +11,6 @@ documentation = "https://docs.rs/async-global-executor" keywords = ["async", "await", "future", "executor"] categories = ["asynchronous", "concurrency"] readme = "README.md" -rust-version = "1.59" [features] default = ["async-io"] @@ -25,6 +24,7 @@ async-executor = "^1.4" async-lock = "^2.5" blocking = "^1.0" futures-lite = "^1.0" +num_cpus = "^1.13" once_cell = "^1.4" [dependencies.async-io] diff --git a/src/config.rs b/src/config.rs index 45048ab..e1d0b9e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -64,7 +64,7 @@ impl GlobalExecutorConfig { .ok() .and_then(|threads| threads.parse().ok()) .or(self.min_threads) - .unwrap_or_else(|| std::thread::available_parallelism().map_or(1, usize::from)) + .unwrap_or_else(num_cpus::get) .max(1); let max_threads = self.max_threads.unwrap_or(min_threads * 4).max(min_threads); Config {