qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject qpid-proton git commit: PROTON-1734: [C++ binding] Allow threaded container tests to run without lambdas
Date Mon, 26 Feb 2018 16:35:56 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 4aebd7946 -> 81ddadc44


PROTON-1734: [C++ binding] Allow threaded container tests to run without lambdas


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/81ddadc4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/81ddadc4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/81ddadc4

Branch: refs/heads/master
Commit: 81ddadc44c1536a04074164571e4093e1b68945c
Parents: 4aebd79
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Mon Feb 26 11:34:44 2018 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon Feb 26 11:34:44 2018 -0500

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/container_test.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/81ddadc4/proton-c/bindings/cpp/src/container_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_test.cpp b/proton-c/bindings/cpp/src/container_test.cpp
index 030e03d..3afb340 100644
--- a/proton-c/bindings/cpp/src/container_test.cpp
+++ b/proton-c/bindings/cpp/src/container_test.cpp
@@ -321,11 +321,21 @@ class test_mt_handler : public proton::messaging_handler {
     void on_connection_open(proton::connection &) PN_CPP_OVERRIDE { set("open"); }
 };
 
+class container_runner {
+    proton::container& c_;
+
+  public:
+    container_runner(proton::container& c) : c_(c) {}
+
+    void operator()() {c_.run();}
+};
+
 int test_container_mt_stop_empty() {
     test_mt_handler th;
     proton::container c(th);
     c.auto_stop( false );
-    auto t = std::thread([&]() { c.run(); });
+    container_runner runner(c);
+    auto t = std::thread(runner);
     ASSERT_EQUAL("start", th.wait());
     c.stop();
     t.join();
@@ -336,7 +346,8 @@ int test_container_mt_stop() {
     test_mt_handler th;
     proton::container c(th);
     c.auto_stop(false);
-    auto t = std::thread([&]() { c.run(); });
+    container_runner runner(c);
+    auto t = std::thread(runner);
     test_listen_handler lh;
     c.listen("//:0", lh);       //  Also opens a connection
     ASSERT_EQUAL("start", th.wait());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message