Kaydet (Commit) e9d64ca0 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/41580Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 1584d521
......@@ -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);
}
}
......
......@@ -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_;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment