Cygwin: implement sched_getcpu

* create new function __get_cpus_per_group to evaluate # of CPU groups
* Call from  format_proc_cpuinfo and sched_getcpu
* Bump API minor version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-08-07 14:51:10 +02:00
parent c233d42264
commit 1e0a1f59d9
10 changed files with 77 additions and 44 deletions

View File

@ -411,4 +411,17 @@ sched_yield ()
SwitchToThread ();
return 0;
}
int
sched_getcpu ()
{
if (!wincap.has_processor_groups ())
return (int) GetCurrentProcessorNumber ();
PROCESSOR_NUMBER pnum;
GetCurrentProcessorNumberEx (&pnum);
return pnum.Group * __get_cpus_per_group () + pnum.Number;
}
} /* extern C */