winpthreads: affinity.c: update `pthread_set_num_processors_np`
This function now ensures that new process affinity mask is strict subset
of the system affinity mask. Additionally, it now tries to preserve as many
bits as possible in the new process affinity mask.
This function now returns number of processors in the process affinity mask;
if the returned number is less than `processorCount`, it either was unable to
set new process affinity mask or it would exceed number of processors in the
system affinity mask. Also, this function now can return zero on failure.
This function now treats `processorCount` of zero as a request to reset
process affinity mask to the system affinity mask; this cannot be done by
passing number returned by `pthread_num_processors_np` since it returns number
of processors in the process affinity mask, which can be smaller than number
of processors in the system affinity mask.
Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
1 file changed