[Libreoffice-commits] core.git: binaryurp/source
Stephan Bergmann
sbergman at redhat.com
Fri Aug 25 20:49:25 UTC 2017
binaryurp/source/proxy.cxx | 4 ++--
binaryurp/source/proxy.hxx | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
New commits:
commit e9d64ca080ed0cf2dcb56be13bee1bffbff880fd
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Aug 25 20:32:22 2017 +0200
Replace use of oslInterlockedCount with std::atomic
The assumption in using std::size_t is that every acquisition can be associated
with a unique memory location in the local address space, so the counter cannot
overflow.
Change-Id: I0d004a81d9bf52cf07d13481d9024fcc10b6db6d
Reviewed-on: https://gerrit.libreoffice.org/41580
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/binaryurp/source/proxy.cxx b/binaryurp/source/proxy.cxx
index 1834968fa50b..699037f915dd 100644
--- a/binaryurp/source/proxy.cxx
+++ b/binaryurp/source/proxy.cxx
@@ -76,13 +76,13 @@ Proxy::Proxy(
void Proxy::do_acquire() {
- if (osl_atomic_increment(&references_) == 1) {
+ if (++references_ == 1) {
bridge_->resurrectProxy(*this);
}
}
void Proxy::do_release() {
- if (osl_atomic_decrement(&references_) == 0) {
+ if (--references_ == 0) {
bridge_->revokeProxy(*this);
}
}
diff --git a/binaryurp/source/proxy.hxx b/binaryurp/source/proxy.hxx
index 5ad8cee120dc..e8ed0fea2dad 100644
--- a/binaryurp/source/proxy.hxx
+++ b/binaryurp/source/proxy.hxx
@@ -22,7 +22,9 @@
#include "sal/config.h"
-#include "osl/interlck.h"
+#include <atomic>
+#include <cstddef>
+
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "typelib/typedescription.h"
@@ -78,7 +80,7 @@ private:
rtl::Reference< Bridge > bridge_;
OUString oid_;
com::sun::star::uno::TypeDescription type_;
- oslInterlockedCount references_;
+ std::atomic<std::size_t> references_;
};
}
More information about the Libreoffice-commits
mailing list