Skip to content

Commit 8daf6fc

Browse files
authored
Use std::thread::available_parallelism (#6)
1 parent cf8ca1d commit 8daf6fc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
os: [ubuntu-latest, windows-latest, macos-latest]
14-
rust: [nightly, beta, stable, 1.49.0]
14+
rust: [nightly, beta, stable, 1.59.0]
1515
steps:
1616
- uses: actions/checkout@v2
1717

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ documentation = "https://docs.rs/async-global-executor"
1111
keywords = ["async", "await", "future", "executor"]
1212
categories = ["asynchronous", "concurrency"]
1313
readme = "README.md"
14+
rust-version = "1.59"
1415

1516
[features]
1617
default = ["async-io"]
@@ -24,7 +25,6 @@ async-executor = "^1.4"
2425
async-lock = "^2.5"
2526
blocking = "^1.0"
2627
futures-lite = "^1.0"
27-
num_cpus = "^1.13"
2828
once_cell = "^1.4"
2929

3030
[dependencies.async-io]

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl GlobalExecutorConfig {
6464
.ok()
6565
.and_then(|threads| threads.parse().ok())
6666
.or(self.min_threads)
67-
.unwrap_or_else(num_cpus::get)
67+
.unwrap_or_else(|| std::thread::available_parallelism().map_or(1, usize::from))
6868
.max(1);
6969
let max_threads = self.max_threads.unwrap_or(min_threads * 4).max(min_threads);
7070
Config {

0 commit comments

Comments
 (0)