summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/SystemInfo.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-11-09 19:38:12 +0000
committerAlan Conway <aconway@apache.org>2007-11-09 19:38:12 +0000
commit23bc7f447a2b2551dc8ae20280ede45b524e06cd (patch)
tree6b004a8876e62afbfcc01b2d2c381ce6c483081a /cpp/src/qpid/sys/SystemInfo.cpp
parent0d7bb38278803b6ac935c0f47edc8a641afa0e52 (diff)
downloadqpid-python-23bc7f447a2b2551dc8ae20280ede45b524e06cd.tar.gz
On Linux, broker defaults --worker-threads to the number of available CPU cores
reported by sysconf(_SC_NPROCESSORS_ONLN) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@593632 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/SystemInfo.cpp')
-rw-r--r--cpp/src/qpid/sys/SystemInfo.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/SystemInfo.cpp b/cpp/src/qpid/sys/SystemInfo.cpp
new file mode 100644
index 0000000000..dcc7ad9985
--- /dev/null
+++ b/cpp/src/qpid/sys/SystemInfo.cpp
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "SystemInfo.h"
+#include <unistd.h>
+
+namespace qpid {
+namespace sys {
+
+long SystemInfo::concurrency() {
+#ifdef _SC_NPROCESSORS_ONLN // Linux specific.
+ return sysconf(_SC_NPROCESSORS_ONLN);
+#else
+ return -1;
+#endif
+}
+
+}} // namespace qpid::sys