@@ -462,8 +462,18 @@ pub fn available_parallelism() -> io::Result<NonZero> { |
|
|
462 |
462 |
|
463 |
463 |
Ok(NonZero::new_unchecked(sinfo.cpu_count as usize)) |
464 |
464 |
} |
|
465 |
+} else if #[cfg(target_os = "vxworks")] { |
|
466 |
+// Note: there is also `vxCpuConfiguredGet`, closer to _SC_NPROCESSORS_CONF |
|
467 |
+// expectations than the actual cores availability. |
|
468 |
+ extern "C" { |
|
469 |
+fn vxCpuEnabledGet() -> libc::cpuset_t; |
|
470 |
+} |
|
471 |
+ |
|
472 |
+// always fetches a valid bitmask |
|
473 |
+let set = unsafe { vxCpuEnabledGet() }; |
|
474 |
+Ok(NonZero::new_unchecked(set.count_ones() as usize)) |
465 |
475 |
} else { |
466 |
|
-// FIXME: implement on vxWorks, Redox, l4re |
|
476 |
+// FIXME: implement on Redox, l4re |
467 |
477 |
Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform")) |
468 |
478 |
} |
469 |
479 |
} |