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"
1818
1919# Some dependencies may not be their latest version, in order to support older rustc.
2020[dependencies ]
21- num_cpus = " 1.2"
2221crossbeam-channel = " 0.5.0"
2322crossbeam-deque = " 0.8.1"
2423crossbeam-utils = " 0.8.0"
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ use std::fmt;
7070use std:: io;
7171use std:: marker:: PhantomData ;
7272use std:: str:: FromStr ;
73+ use std:: thread;
7374
7475#[ macro_use]
7576mod log;
@@ -496,7 +497,8 @@ impl<S> ThreadPoolBuilder<S> {
496497 . and_then ( |s| usize:: from_str ( & s) . ok ( ) )
497498 {
498499 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 ) ,
500502 _ => { }
501503 }
502504
@@ -506,7 +508,7 @@ impl<S> ThreadPoolBuilder<S> {
506508 . and_then ( |s| usize:: from_str ( & s) . ok ( ) )
507509 {
508510 Some ( x) if x > 0 => x,
509- _ => num_cpus :: get ( ) ,
511+ _ => thread :: available_parallelism ( ) . map ( |n| n . get ( ) ) . unwrap_or ( 1 )
510512 }
511513 }
512514 }
You can’t perform that action at this time.
0 commit comments