Bruce Mitchener, Jr.: Port to emscripten. Fixes http://llvm.org/bugs/show_bug.cgi?id=15624.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-03-29 18:27:28 +00:00
parent 8b25c00ef1
commit fc2f021bdd
6 changed files with 46 additions and 16 deletions

View File

@@ -67,7 +67,7 @@ thread::hardware_concurrency() _NOEXCEPT
std::size_t s = sizeof(n);
sysctl(mib, 2, &n, &s, 0, 0);
return n;
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)
#elif (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)) || defined(EMSCRIPTEN)
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.