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/go1
Commit: 9fab77194f6883430ce47b0281328d9354f833cb
Parents: 06e931f
Author: Andrew Stitcher <astitc...@apache.org>
Authored: Wed Mar 28 16:37:53 2018 -0400
Committer: Andrew Stitcher <astitc...@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-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to