diff options
Diffstat (limited to 'contrib/llvm-project/libcxx/src/thread.cpp')
-rw-r--r-- | contrib/llvm-project/libcxx/src/thread.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/contrib/llvm-project/libcxx/src/thread.cpp b/contrib/llvm-project/libcxx/src/thread.cpp index 5f44e9e40fc7..5959d8b71103 100644 --- a/contrib/llvm-project/libcxx/src/thread.cpp +++ b/contrib/llvm-project/libcxx/src/thread.cpp @@ -14,17 +14,9 @@ #include "vector" #include "future" #include "limits" -#include <sys/types.h> - -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -# include <sys/param.h> -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) -# include <sys/sysctl.h> -# endif -#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if __has_include(<unistd.h>) -#include <unistd.h> +# include <unistd.h> // for sysconf #endif #if defined(__NetBSD__) @@ -80,13 +72,7 @@ thread::detach() unsigned thread::hardware_concurrency() _NOEXCEPT { -#if defined(CTL_HW) && defined(HW_NCPU) - unsigned n; - int mib[2] = {CTL_HW, HW_NCPU}; - std::size_t s = sizeof(n); - sysctl(mib, 2, &n, &s, 0, 0); - return n; -#elif defined(_SC_NPROCESSORS_ONLN) +#if defined(_SC_NPROCESSORS_ONLN) long result = sysconf(_SC_NPROCESSORS_ONLN); // sysconf returns -1 if the name is invalid, the option does not exist or // does not have a definite limit. |