Implement the thread policy API#6
Conversation
|
Checking out the main branch as follows and running the same test as in the Github workflow as follows also results in this error: That is, the main branch without this PR currently seems to fail on the same issue as well. This might be a problem with Rust nightly. |
Nah, https://github.com/JohnTitor/mach2/runs/5379204089?check_suite_focus=true shows a lot of errors about |
Apparently, It looks like mach-test tries to compare the Rust code against the C header, which is nice, it just wasn't clear to me initially. I fixed the struct names in Thanks for the pointer. |
JohnTitor
left a comment
There was a problem hiding this comment.
Thanks! Yeah, I personally don't have an ARM Mac and CI env isn't also ready for it, unfortunately.
Anyway the test passes, I'm going to merge :)
This PR implements part of the thread policy API used to retrieve and request the policy for any given thread. More specifically, while this can be used to indicate to Mac OS that the thread is computationally intensive or rather a background thread, this API can also be used to set up latency-based or throughput-based QoS. Furthermore, Mac OS provides an affinity policy that allows one to indirectly set the affinity of threads to indicate whether certain CPU resources such as the L2 cache should or should not be shared between threads. Therefore, the affinity policy can be used as a hint to the scheduler for thread placement.