projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
32dc724
)
Belt and suspenders when calling sysconf
author
Marshall Clow
<mclow@qualcomm.com>
Thu, 7 Feb 2013 18:48:09 +0000
(18:48 +0000)
committer
Marshall Clow
<mclow@qualcomm.com>
Thu, 7 Feb 2013 18:48:09 +0000
(18:48 +0000)
llvm-svn: 174642
libcxx/src/thread.cpp
patch
|
blob
|
history
diff --git
a/libcxx/src/thread.cpp
b/libcxx/src/thread.cpp
index
184d81e
..
447eca7
100644
(file)
--- 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)