summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorgrembo <freebsd@grem.de>2022-01-17 09:46:45 +0100
committerGitHub <noreply@github.com>2022-01-17 09:46:45 +0100
commit6df99efd870840232fb3bd55199f76f9e937cb38 (patch)
tree6f1570bf3a922f800f1dc7f99e853ea5a582c29f /cpp/src/Ice/ThreadPool.cpp
parentFix PHP 8.0 Windows build failure (diff)
downloadice-6df99efd870840232fb3bd55199f76f9e937cb38.tar.bz2
ice-6df99efd870840232fb3bd55199f76f9e937cb38.tar.xz
ice-6df99efd870840232fb3bd55199f76f9e937cb38.zip
Fix ThreadPool on FreeBSD (#1335)
Add missing header and swap reversed lines.
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 915da9869c7..a9181b17e90 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -17,6 +17,10 @@
# include <Ice/StringConverter.h>
#endif
+#if defined(__FreeBSD__)
+# include <sys/sysctl.h>
+#endif
+
using namespace std;
using namespace Ice;
using namespace Ice::Instrumentation;
@@ -303,8 +307,8 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
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;
+ size_t sz = sizeof(nProcessors);
if(sysctl(ncpu, 2, &nProcessors, &sz, 0, 0) == -1)
{
nProcessors = 1;