Skip to content

Commit

Permalink
VxWorks: Add safety comment for vxCpuEnabledGet
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Gross <[email protected]>
  • Loading branch information
biabbas and tgross35 authored Aug 9, 2024
1 parent 4d6b36a commit 39b1eaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
fn vxCpuEnabledGet() -> libc::cpuset_t;
}

// SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set
unsafe{
// always fetches a valid bitmask
let set = vxCpuEnabledGet();
Ok(NonZero::new_unchecked(set.count_ones() as usize))
}
Expand Down

0 comments on commit 39b1eaf

Please sign in to comment.