From d19c702291ff3bd9e769a152e7db96e17f5167f7 Mon Sep 17 00:00:00 2001 From: theraven Date: Thu, 7 Feb 2013 15:45:28 +0000 Subject: Import new libc++ to head. Various small fixes and cleanups. MFC after: 2 weeks --- contrib/libc++/src/thread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'contrib/libc++/src/thread.cpp') diff --git a/contrib/libc++/src/thread.cpp b/contrib/libc++/src/thread.cpp index 8747adf..b2bd07e 100644 --- a/contrib/libc++/src/thread.cpp +++ b/contrib/libc++/src/thread.cpp @@ -67,8 +67,10 @@ thread::hardware_concurrency() _NOEXCEPT return n; #elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN) long result = sysconf(_SC_NPROCESSORS_ONLN); - if (result < 0 || result > UINT_MAX) - result = 0; + // sysconf returns -1 if the name is invalid, the option does not exist or + // does not have a definite limit. + if (result == -1) + return 0; return result; #else // defined(CTL_HW) && defined(HW_NCPU) // TODO: grovel through /proc or check cpuid on x86 and similar -- cgit v1.1