Skip to content

Commit c21ba97

Browse files
committed
Fix VxWorks available parallelism: Move nonzero::uncheked into unsafe block
1 parent 2495418 commit c21ba97

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: std/src/sys/pal/unix/thread.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,11 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
489489
fn vxCpuEnabledGet() -> libc::cpuset_t;
490490
}
491491

492-
// always fetches a valid bitmask
493-
let set = unsafe { vxCpuEnabledGet() };
494-
Ok(NonZero::new_unchecked(set.count_ones() as usize))
492+
unsafe{
493+
// always fetches a valid bitmask
494+
let set = vxCpuEnabledGet();
495+
Ok(NonZero::new_unchecked(set.count_ones() as usize))
496+
}
495497
} else {
496498
// FIXME: implement on Redox, l4re
497499
Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))

0 commit comments

Comments
 (0)