Skip to content

Account for cpu affinity in g_get_num_processors

Kryggird requested to merge kryggird/glib:g_get_num_processors-affinity-fix into main

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)

Merge request reports