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 2021/05/11 15:22:06 UTC
[qpid-proton] branch main updated: PROTON-2377: [cpp] Make
tag_counter in sender.cpp atomic
This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new ea627e7 PROTON-2377: [cpp] Make tag_counter in sender.cpp atomic
ea627e7 is described below
commit ea627e71ef2e6247b5a813a4b21293775ba1b21e
Author: dreampearl <ra...@gmail.com>
AuthorDate: Thu Apr 22 16:48:18 2021 +0530
PROTON-2377: [cpp] Make tag_counter in sender.cpp atomic
---
cpp/include/proton/sender.hpp | 9 +++++++--
cpp/src/sender.cpp | 5 -----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpp/include/proton/sender.hpp b/cpp/include/proton/sender.hpp
index 0f2f29c..8685b58 100644
--- a/cpp/include/proton/sender.hpp
+++ b/cpp/include/proton/sender.hpp
@@ -73,8 +73,13 @@ PN_CPP_CLASS_EXTERN sender : public link {
PN_CPP_EXTERN void return_credit();
/// @cond INTERNAL
- friend class internal::factory<sender>;
- friend class sender_iterator;
+ friend class internal::factory<sender>;
+ friend class sender_iterator;
+ /// @endcond
+
+ private:
+ /// @cond INTERNAL
+ uint64_t tag_counter = 0;
/// @endcond
};
diff --git a/cpp/src/sender.cpp b/cpp/src/sender.cpp
index a956257..6aaeed1 100644
--- a/cpp/src/sender.cpp
+++ b/cpp/src/sender.cpp
@@ -59,11 +59,6 @@ class target sender::target() const {
return proton::target(*this);
}
-namespace {
-// TODO: revisit if thread safety required
-uint64_t tag_counter = 0;
-}
-
tracker sender::send(const message &message) {
uint64_t id = ++tag_counter;
const uint8_t *begin = reinterpret_cast<const uint8_t *>(&id);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org