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/07/21 17:01:59 UTC
[03/20] qpid-proton git commit: PROTON-1481: [C++ binding] Simplify
code to use convenience functions
PROTON-1481: [C++ binding] Simplify code to use convenience functions
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ca446eac
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ca446eac
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ca446eac
Branch: refs/heads/master
Commit: ca446eac8d56ae9510f4ac5dbb1a9ab3dba93ac5
Parents: bf3a2b4
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu May 18 14:14:58 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri Jul 21 12:50:06 2017 -0400
----------------------------------------------------------------------
.../bindings/cpp/include/proton/thread_safe.hpp | 17 ++---------------
.../bindings/cpp/include/proton/work_queue.hpp | 9 ---------
2 files changed, 2 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ca446eac/proton-c/bindings/cpp/include/proton/thread_safe.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/thread_safe.hpp b/proton-c/bindings/cpp/include/proton/thread_safe.hpp
index e5f5303..04e39df 100644
--- a/proton-c/bindings/cpp/include/proton/thread_safe.hpp
+++ b/proton-c/bindings/cpp/include/proton/thread_safe.hpp
@@ -63,12 +63,6 @@ template <class T>
class thread_safe : private internal::pn_ptr_base, private internal::endpoint_traits<T> {
typedef typename T::pn_type pn_type;
- struct inject_decref : public void_function0 {
- pn_type* ptr_;
- inject_decref(pn_type* p) : ptr_(p) {}
- void operator()() PN_CPP_OVERRIDE { decref(ptr_); delete this; }
- };
-
public:
/// @cond INTERNAL
static void operator delete(void*) {}
@@ -76,15 +70,8 @@ class thread_safe : private internal::pn_ptr_base, private internal::endpoint_tr
~thread_safe() {
if (ptr()) {
- if (!!work_queue()) {
-#if PN_CPP_HAS_STD_BIND
- work_queue().add(std::bind(&decref, ptr()));
-#else
- work_queue().add(*new inject_decref(ptr()));
-#endif
- } else {
- decref(ptr());
- }
+ if (!!work_queue().impl_) defer(&work_queue(), &decref, (void*)ptr());
+ else decref(ptr());
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ca446eac/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 4d843c2..fe739f5 100644
--- a/proton-c/bindings/cpp/include/proton/work_queue.hpp
+++ b/proton-c/bindings/cpp/include/proton/work_queue.hpp
@@ -87,15 +87,6 @@ class PN_CPP_CLASS_EXTERN work_queue {
PN_CPP_EXTERN ~work_queue();
-#if PN_CPP_HAS_EXPLICIT_CONVERSIONS
- /// When using C++11 (or later) you can use work_queue in a bool context
- /// to indicate if there is an event loop set.
- PN_CPP_EXTERN explicit operator bool() const { return bool(impl_); }
-#endif
-
- /// No event loop set.
- PN_CPP_EXTERN bool operator !() const { return !impl_; }
-
/// Add work to the work queue: f() will be called serialised with other work in the queue:
/// deferred and possibly in another thread.
///
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org