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 <t.gross35@gmail.com>
  • Loading branch information
biabbas and tgross35 committed Aug 9, 2024
1 parent 2abcc6b commit b20d9f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/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 b20d9f0

Please sign in to comment.