diff options
Diffstat (limited to 'Source/cmAffinity.cxx')
-rw-r--r-- | Source/cmAffinity.cxx | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx index bdf1f42..588b2f2 100644 --- a/Source/cmAffinity.cxx +++ b/Source/cmAffinity.cxx @@ -5,24 +5,24 @@ #include "cm_uv.h" #ifndef CMAKE_USE_SYSTEM_LIBUV -#ifdef _WIN32 -#define CM_HAVE_CPU_AFFINITY -#include <windows.h> -#elif defined(__linux__) || defined(__FreeBSD__) -#define CM_HAVE_CPU_AFFINITY -#include <pthread.h> -#include <sched.h> -#if defined(__FreeBSD__) -#include <pthread_np.h> -#include <sys/cpuset.h> -#include <sys/param.h> -#endif -#if defined(__linux__) +# ifdef _WIN32 +# define CM_HAVE_CPU_AFFINITY +# include <windows.h> +# elif defined(__linux__) || defined(__FreeBSD__) +# define CM_HAVE_CPU_AFFINITY +# include <pthread.h> +# include <sched.h> +# if defined(__FreeBSD__) +# include <pthread_np.h> +# include <sys/cpuset.h> +# include <sys/param.h> +# endif +# if defined(__linux__) typedef cpu_set_t cm_cpuset_t; -#else +# else typedef cpuset_t cm_cpuset_t; -#endif -#endif +# endif +# endif #endif namespace cmAffinity { @@ -33,7 +33,7 @@ std::set<size_t> GetProcessorsAvailable() #ifdef CM_HAVE_CPU_AFFINITY int cpumask_size = uv_cpumask_size(); if (cpumask_size > 0) { -#ifdef _WIN32 +# ifdef _WIN32 DWORD_PTR procmask; DWORD_PTR sysmask; if (GetProcessAffinityMask(GetCurrentProcess(), &procmask, &sysmask) != @@ -44,7 +44,7 @@ std::set<size_t> GetProcessorsAvailable() } } } -#else +# else cm_cpuset_t cpuset; CPU_ZERO(&cpuset); // NOLINT(clang-tidy) if (pthread_getaffinity_np(pthread_self(), sizeof(cpuset), &cpuset) == 0) { @@ -54,7 +54,7 @@ std::set<size_t> GetProcessorsAvailable() } } } -#endif +# endif } #endif return processorsAvailable; |