You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2018/03/28 20:41:23 UTC
qpid-proton git commit: PROTON-1817: [C++ binding] Fix example broker
to compile with C++11
Repository: qpid-proton
Updated Branches:
refs/heads/master 06e931f6e -> 9fab77194
PROTON-1817: [C++ binding] Fix example broker to compile with C++11
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9fab7719
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9fab7719
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9fab7719
Branch: refs/heads/master
Commit: 9fab77194f6883430ce47b0281328d9354f833cb
Parents: 06e931f
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Mar 28 16:37:53 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Mar 28 16:37:53 2018 -0400
----------------------------------------------------------------------
examples/cpp/broker.cpp | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9fab7719/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index f48fb37..65384b3 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -42,8 +42,12 @@
#include <map>
#include <string>
-#if PN_CPP_SUPPORTS_THREADS
+#if PN_CPP_HAS_STD_THREAD
#include <thread>
+
+int hardware_concurrency() {return std::thread::hardware_concurrency();}
+#else
+int hardware_concurrency() {return 1;}
#endif
#include "fake_cpp11.hpp"
@@ -393,10 +397,13 @@ class broker {
void run() {
#if PN_CPP_SUPPORTS_THREADS
- std::cout << "starting " << std::thread::hardware_concurrency() << " listening threads\n";
+ int threads = hardware_concurrency();
+ std::cout << "starting " << threads << " listening threads\n";
std::cout.flush();
- container_.run(std::thread::hardware_concurrency());
+ container_.run(threads);
#else
+ std::cout << "no thread support - starting 1 listening thread\n";
+ std::cout.flush();
container_.run();
#endif
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org