File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ name = "rayon_core"
18
18
19
19
# Some dependencies may not be their latest version, in order to support older rustc.
20
20
[dependencies ]
21
- num_cpus = " 1.2"
22
21
crossbeam-channel = " 0.5.0"
23
22
crossbeam-deque = " 0.8.1"
24
23
crossbeam-utils = " 0.8.0"
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ use std::fmt;
70
70
use std:: io;
71
71
use std:: marker:: PhantomData ;
72
72
use std:: str:: FromStr ;
73
+ use std:: thread;
73
74
74
75
#[ macro_use]
75
76
mod log;
@@ -496,7 +497,8 @@ impl<S> ThreadPoolBuilder<S> {
496
497
. and_then ( |s| usize:: from_str ( & s) . ok ( ) )
497
498
{
498
499
Some ( x) if x > 0 => return x,
499
- Some ( x) if x == 0 => return num_cpus:: get ( ) ,
500
+ Some ( x) if x == 0 => return thread:: available_parallelism ( )
501
+ . map ( |n| n. get ( ) ) . unwrap_or ( 1 ) ,
500
502
_ => { }
501
503
}
502
504
@@ -506,7 +508,7 @@ impl<S> ThreadPoolBuilder<S> {
506
508
. and_then ( |s| usize:: from_str ( & s) . ok ( ) )
507
509
{
508
510
Some ( x) if x > 0 => x,
509
- _ => num_cpus :: get ( ) ,
511
+ _ => thread :: available_parallelism ( ) . map ( |n| n . get ( ) ) . unwrap_or ( 1 )
510
512
}
511
513
}
512
514
}
You can’t perform that action at this time.
0 commit comments