On segunda-feira, 9 de janeiro de 2017 19:01:31 PST Riccardo Rossi wrote:
> Well, glibc's
>
> sched_getcpu()
>
> Would do for example...And there is a similar función for windows
It doesn't work because the information is stale by the time you've got it.
Unless you've pinned your thread to a given vCPU, the OS scheduler is allowed
to de-schedule your thread and re-schedule it elsewhere.
On Linux, you'd need the sched_setaffinity call, which is documented to require
CAP_SYS_NICE privileges.
> Please be didactic...
> The fact that there is no way to do It ... is it by design? If so...why?