summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-07-02 17:31:08 +0200
committerJose <jose@zeroc.com>2019-07-02 17:31:08 +0200
commit5ff454c980022b2399511011f5d503a77b231e8f (patch)
tree40e22c4c1fb834c7f940b8c35ba9f13a47ceaa89 /cpp/src/Ice/ThreadPool.cpp
parentupdate Cartfile.resolved (diff)
parentCheck sysconf errors Close #418 (#420) (diff)
downloadice-5ff454c980022b2399511011f5d503a77b231e8f.tar.bz2
ice-5ff454c980022b2399511011f5d503a77b231e8f.tar.xz
ice-5ff454c980022b2399511011f5d503a77b231e8f.zip
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-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 f1be4dcb8dc..bbd8b49d087 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -300,8 +300,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