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