summaryrefslogtreecommitdiff
path: root/cpp/src/Ice
diff options
context:
space:
mode:
authorJose <pepone@users.noreply.github.com>2019-07-02 12:02:08 +0200
committerGitHub <noreply@github.com>2019-07-02 12:02:08 +0200
commitd44f1fb14cbdae099fcf7dafd0d247a4555a02bc (patch)
tree29c7a1b86b6a5944097318ed2b8cd2ea9137b9dc /cpp/src/Ice
parentWait 60s for the process controller to start (needed for Android) (diff)
downloadice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.tar.bz2
ice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.tar.xz
ice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.zip
Check sysconf errors Close #418 (#420)
Diffstat (limited to 'cpp/src/Ice')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index b836137170a..7d95c48b2b5 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -273,8 +273,20 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
int nProcessors = sysInfo.dwNumberOfProcessors;
+# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ static int ncpu[2] = { CTL_HW, HW_NCPU };
+ size_t sz = sizeof(nProcessors);
+ int nProcessors;
+ if(sysctl(ncpu, 2, &nProcessors, &sz, 0, 0) == -1)
+ {
+ nProcessors = 1;
+ }
# else
int nProcessors = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
+ if(nProcessors == -1)
+ {
+ nProcessors = 1;
+ }
# endif
#endif