jhpratt / num_threads

Obtain the number of threads in the current process
https://docs.rs/num_threads
Apache License 2.0
11 stars 7 forks source link

Implement MacOS #4

Closed PhotonQuantum closed 2 years ago

PhotonQuantum commented 2 years ago

Trying to make it work on macos so that the time crate can return local_offset.

However I'm not sure whether the proc_pidinfo call is thread-safe because it's an apple internal api. Looks like it copies task info struct to given buffer, so I assume the buffer is properly initialized.

PhotonQuantum commented 2 years ago

Yes, this code runs on my m1 based mbp.

jhpratt commented 2 years ago

CI is failing. I believe it's because the extern crate libc; line isn't sufficiently gated. Otherwise this LGTM with the caveat that we should probably check malloc for failure.

jhpratt commented 2 years ago

Thanks again. Will release tonight.