diff options
author | theraven <theraven@FreeBSD.org> | 2013-02-07 13:09:19 +0000 |
---|---|---|
committer | theraven <theraven@FreeBSD.org> | 2013-02-07 13:09:19 +0000 |
commit | fab14d3df75fc3af83c06ed85bb9c068f1144351 (patch) | |
tree | d1f057460d329356b56f67bf5740b7393c925844 /src/thread.cpp | |
parent | 3deb12eac5b63fcfb8306b76b41032a9083ae563 (diff) | |
download | FreeBSD-src-fab14d3df75fc3af83c06ed85bb9c068f1144351.zip FreeBSD-src-fab14d3df75fc3af83c06ed85bb9c068f1144351.tar.gz |
Import new libc++ to vendor branch.
Diffstat (limited to 'src/thread.cpp')
-rw-r--r-- | src/thread.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/thread.cpp b/src/thread.cpp index 8747adf..b2bd07e 100644 --- a/src/thread.cpp +++ b/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 |