Account for cpu affinity in g_get_num_processors
Right now, g_get_num_processors takes CPU affinity into account only on Windows. On Posix systems, it returns the number of logical cores.
This commit replicates the Windows logic on systems where the pthread_getaffinity_np Posix interface is available, and leaves behaviour unchanged otherwise.
Fixes #1010 (closed)