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 2017/09/19 20:10:08 UTC

[1/3] qpid-proton git commit: NO-JIRA: Fix Python 2.6 test compatibility correctly(ish) Revert "NO-JIRA: c++ examples, fix broken "skipUnless" workaround"

Repository: qpid-proton
Updated Branches:
  refs/heads/master c52a2100f -> cdd86bcfe


NO-JIRA: Fix Python 2.6 test compatibility correctly(ish)
Revert "NO-JIRA: c++ examples, fix broken "skipUnless" workaround"


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

Branch: refs/heads/master
Commit: b5a5689d6a17070aa96ab8ff955d738ec65f166d
Parents: c52a210
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Sep 19 15:50:21 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 19 15:57:06 2017 -0400

----------------------------------------------------------------------
 examples/cpp/example_test.py | 84 ++++++++++++++++++---------------------
 tools/py/proctest.py         | 29 ++++++++++++++
 2 files changed, 68 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b5a5689d/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 8c005c6..6dd8587 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -33,29 +33,29 @@ from string import Template
 createdSASLDb = False
 
 def _cyrusSetup(conf_dir):
-    """Write out simple SASL config.tests
-    """
-    saslpasswd = os.getenv('SASLPASSWD') or find_file('saslpasswd2', os.getenv('PATH'))
-    if saslpasswd:
-        t = Template("""sasldb_path: ${db}
+  """Write out simple SASL config.tests
+  """
+  saslpasswd = os.getenv('SASLPASSWD') or find_file('saslpasswd2', os.getenv('PATH'))
+  if saslpasswd:
+    t = Template("""sasldb_path: ${db}
 mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
 """)
-        abs_conf_dir = os.path.abspath(conf_dir)
-        call(args=['rm','-rf',abs_conf_dir])
-        os.mkdir(abs_conf_dir)
-        db = os.path.join(abs_conf_dir,'proton.sasldb')
-        conf = os.path.join(abs_conf_dir,'proton-server.conf')
-        f = open(conf, 'w')
-        f.write(t.substitute(db=db))
-        f.close()
-
-        cmd_template = Template("echo password | ${saslpasswd} -c -p -f ${db} -u proton user")
-        cmd = cmd_template.substitute(db=db, saslpasswd=saslpasswd)
-        call(args=cmd, shell=True)
-
-        os.environ['PN_SASL_CONFIG_PATH'] = abs_conf_dir
-        global createdSASLDb
-        createdSASLDb = True
+    abs_conf_dir = os.path.abspath(conf_dir)
+    call(args=['rm','-rf',abs_conf_dir])
+    os.mkdir(abs_conf_dir)
+    db = os.path.join(abs_conf_dir,'proton.sasldb')
+    conf = os.path.join(abs_conf_dir,'proton-server.conf')
+    f = open(conf, 'w')
+    f.write(t.substitute(db=db))
+    f.close()
+
+    cmd_template = Template("echo password | ${saslpasswd} -c -p -f ${db} -u proton user")
+    cmd = cmd_template.substitute(db=db, saslpasswd=saslpasswd)
+    call(args=cmd, shell=True)
+
+    os.environ['PN_SASL_CONFIG_PATH'] = abs_conf_dir
+    global createdSASLDb
+    createdSASLDb = True
 
 # Globally initialize Cyrus SASL configuration
 _cyrusSetup('sasl_conf')
@@ -110,14 +110,14 @@ class ContainerExampleTest(BrokerTestCase):
 
     def test_simple_send_recv(self):
         self.assertMultiLineEqual("all messages confirmed\n",
-                                  self.proc(["simple_send", "-a", self.addr]).wait_exit())
+                         self.proc(["simple_send", "-a", self.addr]).wait_exit())
         self.assertMultiLineEqual(recv_expect("simple_recv", self.addr), self.proc(["simple_recv", "-a", self.addr]).wait_exit())
 
     def test_simple_recv_send(self):
         # Start receiver first, then run sender"""
         recv = self.proc(["simple_recv", "-a", self.addr])
         self.assertMultiLineEqual("all messages confirmed\n",
-                                  self.proc(["simple_send", "-a", self.addr]).wait_exit())
+                         self.proc(["simple_send", "-a", self.addr]).wait_exit())
         self.assertMultiLineEqual(recv_expect("simple_recv", self.addr), recv.wait_exit())
 
 
@@ -127,7 +127,7 @@ class ContainerExampleTest(BrokerTestCase):
             recv = self.proc(["direct_recv", "-a", addr])
             recv.wait_re("listening")
             self.assertMultiLineEqual("all messages confirmed\n",
-                                      self.proc(["simple_send", "-a", addr]).wait_exit())
+                             self.proc(["simple_send", "-a", addr]).wait_exit())
             self.assertMultiLineEqual(recv_expect("direct_recv", addr), recv.wait_exit())
 
     def test_simple_recv_direct_send(self):
@@ -136,7 +136,7 @@ class ContainerExampleTest(BrokerTestCase):
             send = self.proc(["direct_send", "-a", addr])
             send.wait_re("listening")
             self.assertMultiLineEqual(recv_expect("simple_recv", addr),
-                                      self.proc(["simple_recv", "-a", addr]).wait_exit())
+                             self.proc(["simple_recv", "-a", addr]).wait_exit())
             self.assertMultiLineEqual(
                 "direct_send listening on %s\nall messages confirmed\n" % addr,
                 send.wait_exit())
@@ -145,7 +145,7 @@ class ContainerExampleTest(BrokerTestCase):
         server = self.proc(["server", "-a", self.addr])
         server.wait_re("connected")
         self.assertMultiLineEqual(CLIENT_EXPECT,
-                                  self.proc(["client", "-a", self.addr]).wait_exit())
+                         self.proc(["client", "-a", self.addr]).wait_exit())
 
     def test_request_response_direct(self):
         with TestPort() as tp:
@@ -153,7 +153,7 @@ class ContainerExampleTest(BrokerTestCase):
             server = self.proc(["server_direct", "-a", addr])
             server.wait_re("listening")
             self.assertMultiLineEqual(CLIENT_EXPECT,
-                                      self.proc(["client", "-a", addr]).wait_exit())
+                             self.proc(["client", "-a", addr]).wait_exit())
 
     def test_flow_control(self):
         want="""success: Example 1: simple credit
@@ -197,13 +197,11 @@ map{string(k1):int(42), symbol(k2):boolean(0)}
         self.assertTrue(len(out) > 0);
         self.assertEqual(["send"]*len(out), out)
 
+    @unittest.skipUnless(find_exes('scheduled_send'), "not a  C++11 build")
     def test_scheduled_send(self):
-        try:
-            out = self.proc(["scheduled_send", "-a", self.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).wait_exit().split()
-            self.assertTrue(len(out) > 0);
-            self.assertEqual(["send"]*len(out), out)
-        except NotFoundError:
-          sys.stderr.write("SKIP: executable not found, not a C++11 build\n") 
+        out = self.proc(["scheduled_send", "-a", self.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).wait_exit().split()
+        self.assertTrue(len(out) > 0);
+        self.assertEqual(["send"]*len(out), out)
 
     def test_message_properties(self):
         expect="""using put/get: short=123 string=foo symbol=sym
@@ -217,21 +215,17 @@ expected conversion_error: "unexpected type, want: uint got: string"
 """
         self.assertMultiLineEqual(expect, self.proc(["message_properties"]).wait_exit())
 
+    @unittest.skipUnless(find_exes('multithreaded_client'), "not a  C++11 build")
     def test_multithreaded_client(self):
-        try:
-            got = self.proc(["multithreaded_client", self.addr, "examples", "10"], helgrind=True).wait_exit()
-            self.maxDiff = None
-            self.assertRegexpMatches(got, "10 messages sent and received");
-        except NotFoundError:
-          sys.stderr.write("SKIP: executable not found, not a C++11 build\n") 
+        got = self.proc(["multithreaded_client", self.addr, "examples", "10"], helgrind=True).wait_exit()
+        self.maxDiff = None
+        self.assertRegexpMatches(got, "10 messages sent and received");
 
+    @unittest.skipUnless(find_exes('multithreaded_client_flow_control'), "not a  C++11 build")
     def test_multithreaded_client_flow_control(self):
-        try:
-            got = self.proc(["multithreaded_client_flow_control", self.addr, "examples", "10", "2"], helgrind=True).wait_exit()
-            self.maxDiff = None
-            self.assertRegexpMatches(got, "20 messages sent and received");
-        except NotFoundError:
-          sys.stderr.write("SKIP: executable not found, not a C++11 build\n") 
+        got = self.proc(["multithreaded_client_flow_control", self.addr, "examples", "10", "2"], helgrind=True).wait_exit()
+        self.maxDiff = None
+        self.assertRegexpMatches(got, "20 messages sent and received");
 
 class ContainerExampleSSLTest(BrokerTestCase):
     """Run the SSL container examples, verify they behave as expected."""

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b5a5689d/tools/py/proctest.py
----------------------------------------------------------------------
diff --git a/tools/py/proctest.py b/tools/py/proctest.py
index c829048..947e7a5 100644
--- a/tools/py/proctest.py
+++ b/tools/py/proctest.py
@@ -194,12 +194,15 @@ class ProcTestCase(unittest.TestCase):
                     return inspect.ismethod(m) and m.__name__.startswith('test_')
                 cls._setup_class_count = len(inspect.getmembers(cls, predicate=is_test))
                 cls.setUpClass()
+            self.procs = []
 
         def tearDown(self):
             self.assertTrue(self._setup_class_count > 0)
             self._setup_class_count -=  1
             if self._setup_class_count == 0:
                 type(self).tearDownClass()
+            for p in self.procs:
+                p.kill()
             super(ProcTestCase, self).tearDown()
 
     if _tc_missing('assertIn'):
@@ -230,6 +233,32 @@ def find_exes(*filenames):
         if not find_file(f, os.getenv('PATH')): return False
     return True
 
+#### Skip decorators missing in python 2.6
+
+def _id(obj):
+    return obj
+
+from functools import wraps
+
+def skip(reason):
+    def decorator(test):
+       @wraps(test)
+       def skipper(*args, **kwargs):
+           print("skipped %s: %s" % (test.__name__, reason))
+       return skipper
+    return decorator
+
+def skipIf(cond, reason):
+    if cond: return skip(reason)
+    else: return _id
+
+def skipUnless(cond, reason):
+    if not cond: return skip(reason)
+    else: return _id
+
+if not hasattr(unittest, 'skip'): unittest.skip = skip
+if not hasattr(unittest, 'skipIf'): unittest.skipIf = skipIf
+if not hasattr(unittest, 'skipUnless'): unittest.skipUnless = skipUnless
 
 from unittest import main
 if __name__ == "__main__":


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


[3/3] qpid-proton git commit: PROTON-1590: [C++ binding] Make sasl and ssl objects copyable and assignable - Only ensure that they can't be default constructed (as that makes little sense) - In retrospect only allowing these objects to be copied/assigned

Posted by as...@apache.org.
PROTON-1590: [C++ binding] Make sasl and ssl objects copyable and assignable
- Only ensure that they can't be default constructed (as that makes little sense)
- In retrospect only allowing these objects to be copied/assigned is harmless
- This fixes some issues when mixing C++03 and C++11 compilation


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

Branch: refs/heads/master
Commit: cdd86bcfe748bb979d7f7f1a07a73ed81b0acabe
Parents: 80d76d6
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Sep 18 11:32:50 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 19 15:58:17 2017 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/sasl.hpp    | 14 ++++----------
 proton-c/bindings/cpp/include/proton/ssl.hpp     | 19 ++++++++++---------
 .../bindings/cpp/src/include/proton_bits.hpp     |  4 ----
 proton-c/bindings/cpp/src/transport.cpp          |  4 ++--
 4 files changed, 16 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/include/proton/sasl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sasl.hpp b/proton-c/bindings/cpp/include/proton/sasl.hpp
index e381dc7..a054086 100644
--- a/proton-c/bindings/cpp/include/proton/sasl.hpp
+++ b/proton-c/bindings/cpp/include/proton/sasl.hpp
@@ -41,19 +41,13 @@ class sasl {
     sasl(pn_sasl_t* s) : object_(s) {}
     /// @endcond
 
-  public:
 #if PN_CPP_HAS_DELETED_FUNCTIONS
     sasl() = delete;
-    sasl(const sasl&) = delete;
-    sasl& operator=(const sasl&) = delete;
-    sasl& operator=(sasl&&) = delete;
-#endif
-#if PN_CPP_HAS_DEFAULTED_FUNCTIONS
-    /// @cond INTERNAL
-    sasl(sasl&&) = default;
-    /// @endcond
+#else
+    sasl();
 #endif
 
+  public:
     /// The result of the SASL negotiation.
     enum outcome {
         NONE = PN_SASL_NONE,   ///< Negotiation not completed
@@ -77,7 +71,7 @@ class sasl {
   private:
     pn_sasl_t* const object_;
 
-    friend class internal::factory<sasl>;
+    friend class transport;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/include/proton/ssl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ssl.hpp b/proton-c/bindings/cpp/include/proton/ssl.hpp
index 8186f71..62a0dc4 100644
--- a/proton-c/bindings/cpp/include/proton/ssl.hpp
+++ b/proton-c/bindings/cpp/include/proton/ssl.hpp
@@ -23,6 +23,8 @@
  */
 
 #include "./internal/export.hpp"
+#include "./internal/config.hpp"
+
 
 #include <proton/ssl.h>
 
@@ -33,20 +35,19 @@
 
 namespace proton {
 
-namespace internal {
-template <class T> class factory;
-}
-
 /// SSL information.
 class ssl {
     /// @cond INTERNAL
     ssl(pn_ssl_t* s) : object_(s) {}
     /// @endcond
 
-  public:
-    /// Create an empty ssl object.
-    ssl() : object_(0) {}
+#if PN_CPP_HAS_DELETED_FUNCTIONS
+    ssl() = delete;
+#else
+    ssl();
+#endif
 
+  public:
     /// Determines the level of peer validation.
     enum verify_mode {
         /// Require peer to provide a valid identifying certificate
@@ -88,10 +89,10 @@ class ssl {
     /// @endcond
 
   private:
-    pn_ssl_t* object_;
+    pn_ssl_t* const object_;
 
     /// @cond INTERNAL
-  friend class internal::factory<ssl>;
+  friend class transport;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/src/include/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_bits.hpp b/proton-c/bindings/cpp/src/include/proton_bits.hpp
index 675249f..b6636f9 100644
--- a/proton-c/bindings/cpp/src/include/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/include/proton_bits.hpp
@@ -91,8 +91,6 @@ namespace internal {
 template <class T> struct wrapped {};
 template <> struct wrapped<internal::data> { typedef pn_data_t type; };
 template <> struct wrapped<transport> { typedef pn_transport_t type; };
-template <> struct wrapped<sasl> { typedef pn_sasl_t type; };
-template <> struct wrapped<ssl> { typedef pn_ssl_t type; };
 template <> struct wrapped<connection> { typedef pn_connection_t type; };
 template <> struct wrapped<session> { typedef pn_session_t type; };
 template <> struct wrapped<link> { typedef pn_link_t type; };
@@ -109,8 +107,6 @@ template <> struct wrapped<target> { typedef pn_terminus_t type; };
 template <class T> struct wrapper {};
 template <> struct wrapper<pn_data_t> { typedef internal::data type; };
 template <> struct wrapper<pn_transport_t> { typedef transport type; };
-template <> struct wrapper<pn_sasl_t> { typedef sasl type; };
-template <> struct wrapper<pn_ssl_t> { typedef ssl type; };
 template <> struct wrapper<pn_connection_t> { typedef connection type; };
 template <> struct wrapper<pn_session_t> { typedef session type; };
 template <> struct wrapper<pn_link_t> { typedef link type; };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/src/transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp
index da3119e..bd487dd 100644
--- a/proton-c/bindings/cpp/src/transport.cpp
+++ b/proton-c/bindings/cpp/src/transport.cpp
@@ -39,11 +39,11 @@ connection transport::connection() const {
 }
 
 class ssl transport::ssl() const {
-    return make_wrapper(pn_ssl(pn_object()));
+    return pn_ssl(pn_object());
 }
 
 class sasl transport::sasl() const {
-    return make_wrapper(pn_sasl(pn_object()));
+    return pn_sasl(pn_object());
 }
 
 error_condition transport::error() const {


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


[2/3] qpid-proton git commit: PROTON-1481/PROTON-1590: [C++ binding] Fix ABI problems with mixed C++03/C++11 compilations - Different versions of the proton::work class exist in different namespaces. - When the library is compiled as C++11 both version

Posted by as...@apache.org.
PROTON-1481/PROTON-1590: [C++ binding] Fix ABI problems with mixed C++03/C++11 compilations
- Different versions of the proton::work class exist in different
  namespaces.
- When the library is compiled as C++11 both versions of the work APIs are compiled
- However when client programs are compiled only one version of the work APIs
  (either 03 or 11, but not both) are available.
- This is hacky but should work as none of these APIs are virtual so don't affect ABI layout


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

Branch: refs/heads/master
Commit: 80d76d64893a4fe3d540b5927c32952a3133f348
Parents: b5a5689
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Sep 14 23:16:54 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 19 15:57:53 2017 -0400

----------------------------------------------------------------------
 .../bindings/cpp/include/proton/container.hpp   |  8 +++
 proton-c/bindings/cpp/include/proton/fwd.hpp    | 14 +++++-
 .../bindings/cpp/include/proton/work_queue.hpp  | 51 ++++++++++++++++----
 proton-c/bindings/cpp/src/container.cpp         |  5 +-
 proton-c/bindings/cpp/src/work_queue.cpp        | 20 +++++++-
 5 files changed, 84 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/80d76d64/proton-c/bindings/cpp/include/proton/container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/container.hpp b/proton-c/bindings/cpp/include/proton/container.hpp
index 64caa15..6b02282 100644
--- a/proton-c/bindings/cpp/include/proton/container.hpp
+++ b/proton-c/bindings/cpp/include/proton/container.hpp
@@ -290,6 +290,14 @@ class PN_CPP_CLASS_EXTERN container {
     /// `std::function<void()>` type for the `fn` parameter.
     PN_CPP_EXTERN void schedule(duration dur, work fn);
 
+    /// @cond INTERNAL
+    /// This is a hack to ensure that the C++03 version is declared
+    /// only during the compilation of the library
+#if PN_CPP_HAS_STD_FUNCTION && defined(qpid_proton_cpp_EXPORTS)
+    PN_CPP_EXTERN void schedule(duration dur, v03::work fn);
+#endif
+    /// @endcond
+
   private:
     class impl;
     internal::pn_unique_ptr<impl> impl_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/80d76d64/proton-c/bindings/cpp/include/proton/fwd.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/fwd.hpp b/proton-c/bindings/cpp/include/proton/fwd.hpp
index 679b974..c5d2ccf 100644
--- a/proton-c/bindings/cpp/include/proton/fwd.hpp
+++ b/proton-c/bindings/cpp/include/proton/fwd.hpp
@@ -25,6 +25,8 @@
 /// @file
 /// Forward declarations.
 
+#include "./internal/config.hpp"
+
 namespace proton {
 
 class annotation_key;
@@ -57,9 +59,19 @@ class tracker;
 class transport;
 class url;
 class void_function0;
-class work;
 class work_queue;
 
+namespace v03 { class work; }
+#if PN_CPP_HAS_STD_FUNCTION
+namespace v11 { class work; }
+#endif
+
+#if PN_CPP_HAS_STD_FUNCTION
+using v11::work;
+#else
+using v03::work;
+#endif
+
 namespace io {
 
 class connection_driver;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/80d76d64/proton-c/bindings/cpp/include/proton/work_queue.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/work_queue.hpp b/proton-c/bindings/cpp/include/proton/work_queue.hpp
index a4244c7..1729080 100644
--- a/proton-c/bindings/cpp/include/proton/work_queue.hpp
+++ b/proton-c/bindings/cpp/include/proton/work_queue.hpp
@@ -44,9 +44,27 @@ namespace proton {
 ///
 /// It can be created from a function that takes no parameters and
 /// returns no value.
+namespace v03 {
 class work {
   public:
+    /// **Experimental**
+    work(void_function0& f): item_(&f) {}
+
+    /// **Experimental**
+    void operator()() { (*item_)(); }
+
+    ~work() {}
+
+
+  private:
+    void_function0* item_;
+};
+}
+
 #if PN_CPP_HAS_STD_FUNCTION
+namespace v11 {
+class work {
+  public:
     /// **Unsettled API**
     work(void_function0& f): item_( [&f]() { f(); }) {}
 
@@ -57,23 +75,20 @@ class work {
 
     /// **Unsettled API**
     void operator()() { item_(); }
-#else
-    /// **Experimetnal**
-    work(void_function0& f): item_(&f) {}
 
-    /// **Experimetnal**
-    void operator()() { (*item_)(); }
-#endif
     ~work() {}
 
-
   private:
-#if PN_CPP_HAS_STD_FUNCTION
     std::function<void()> item_;
+};
+}
+#endif
+
+#if PN_CPP_HAS_STD_FUNCTION
+using v11::work;
 #else
-    void_function0* item_;
+using v03::work;
 #endif
-};
 
 /// **Unsettled API** - A context for thread-safe execution of work.
 ///
@@ -116,6 +131,14 @@ class PN_CPP_CLASS_EXTERN work_queue {
     /// reason.
     PN_CPP_EXTERN bool add(work fn);
 
+    /// @cond INTERNAL
+    /// This is a hack to ensure that the C++03 version is declared
+    /// only during the compilation of the library
+#if PN_CPP_HAS_STD_FUNCTION && defined(qpid_proton_cpp_EXPORTS)
+    PN_CPP_EXTERN bool add(v03::work fn);
+#endif
+    /// @endcond
+
     /// **Unsettled API** - Add work `fn` to the work queue after a
     /// duration.
     ///
@@ -126,6 +149,14 @@ class PN_CPP_CLASS_EXTERN work_queue {
     /// @copydetails add()
     PN_CPP_EXTERN void schedule(duration, work fn);
 
+    /// @cond INTERNAL
+    /// This is a hack to ensure that the C++03 version is declared
+    /// only during the compilation of the library
+#if PN_CPP_HAS_STD_FUNCTION && defined(qpid_proton_cpp_EXPORTS)
+    PN_CPP_EXTERN void schedule(duration, v03::work fn);
+#endif
+    /// @endcond
+
   private:
     PN_CPP_EXTERN static work_queue& get(pn_connection_t*);
     PN_CPP_EXTERN static work_queue& get(pn_session_t*);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/80d76d64/proton-c/bindings/cpp/src/container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container.cpp b/proton-c/bindings/cpp/src/container.cpp
index c82e1a8..11218db 100644
--- a/proton-c/bindings/cpp/src/container.cpp
+++ b/proton-c/bindings/cpp/src/container.cpp
@@ -106,7 +106,10 @@ returned<receiver> container::open_receiver(
 
 std::string container::id() const { return impl_->id(); }
 
-void container::schedule(duration d, work f) { return impl_->schedule(d, f); }
+void container::schedule(duration d, v03::work f) { return impl_->schedule(d, f); }
+#if PN_CPP_HAS_STD_FUNCTION
+void container::schedule(duration d, v11::work f) { return impl_->schedule(d, f); }
+#endif
 
 void container::client_connection_options(const connection_options& c) { impl_->client_connection_options(c); }
 connection_options container::client_connection_options() const { return impl_->client_connection_options(); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/80d76d64/proton-c/bindings/cpp/src/work_queue.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/work_queue.cpp b/proton-c/bindings/cpp/src/work_queue.cpp
index f8fc45c..c8da7fb 100644
--- a/proton-c/bindings/cpp/src/work_queue.cpp
+++ b/proton-c/bindings/cpp/src/work_queue.cpp
@@ -37,17 +37,33 @@ work_queue::~work_queue() {}
 
 work_queue& work_queue::operator=(impl* i) { impl_.reset(i); return *this; }
 
-bool work_queue::add(work f) {
+bool work_queue::add(v03::work f) {
     // If we have no actual work queue, then can't defer
     if (!impl_) return false;
     return impl_->add(f);
 }
 
-void work_queue::schedule(duration d, work f) {
+#if PN_CPP_HAS_STD_FUNCTION
+bool work_queue::add(v11::work f) {
+    // If we have no actual work queue, then can't defer
+    if (!impl_) return false;
+    return impl_->add(f);
+}
+#endif
+
+void work_queue::schedule(duration d, v03::work f) {
+    // If we have no actual work queue, then can't defer
+    if (!impl_) return;
+    return impl_->schedule(d, f);
+}
+
+#if PN_CPP_HAS_STD_FUNCTION
+void work_queue::schedule(duration d, v11::work f) {
     // If we have no actual work queue, then can't defer
     if (!impl_) return;
     return impl_->schedule(d, f);
 }
+#endif
 
 work_queue& work_queue::get(pn_connection_t* c) {
     return connection_context::get(c).work_queue_;


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