summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorMarshall Clow <mclow@qualcomm.com>2013-02-07 18:48:09 +0000
committerMarshall Clow <mclow@qualcomm.com>2013-02-07 18:48:09 +0000
commit0749262a1148a73d110885602b4d9e9017a3f04d (patch)
tree9255b554e921f95086f99fb653d1338edab26f40 /libcxx/src
parent32dc72492058af532fd6cfd9e5cf6364d6b421db (diff)
downloadbcm5719-llvm-0749262a1148a73d110885602b4d9e9017a3f04d.tar.gz
bcm5719-llvm-0749262a1148a73d110885602b4d9e9017a3f04d.zip
Belt and suspenders when calling sysconf
llvm-svn: 174642
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/thread.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 184d81e6b2f..447eca7b019 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -69,7 +69,9 @@ thread::hardware_concurrency() _NOEXCEPT
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.
- if (result == -1)
+ // if sysconf returns some other negative number, we have no idea
+ // what is going on. Default to something safe.
+ if (result < 0)
return 0;
return static_cast<unsigned>(result);
#else // defined(CTL_HW) && defined(HW_NCPU)
OpenPOWER on IntegriCloud