How to find the current thread processor works for Mac and BSD?

I am looking for a function on Mac OS and BSD that is equivalent to Linux sched_getcpu()and Windows' GetCurrentProcessorNumberEx()to implement a library for local cpu storage. Obviously, you can imitate this using the cpuid or rdtscp instructions, but it is better to work with kernel cooperation: https://lkml.org/lkml/2007/1/6/190 .

I already know that the current processor of the processor may change by the time this information is used.

+5
source share
1 answer

, OSX, dispatch_get_global_queue, BSD. , CPU, , .

+2

All Articles