aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/common/sharedobject.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:15 +0300
commite9d19cec64684c9c1e6b0c98297e5b895cf904fe (patch)
tree2768b1223e96a8a0610a93d18425d9647c1123c8 /contrib/libs/icu/common/sharedobject.cpp
parent60040c91ffe701a84689b2c6310ff845e65cff42 (diff)
downloadydb-e9d19cec64684c9c1e6b0c98297e5b895cf904fe.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/common/sharedobject.cpp')
-rw-r--r--contrib/libs/icu/common/sharedobject.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/libs/icu/common/sharedobject.cpp b/contrib/libs/icu/common/sharedobject.cpp
index 6eeca8605f..b2fbd35180 100644
--- a/contrib/libs/icu/common/sharedobject.cpp
+++ b/contrib/libs/icu/common/sharedobject.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,10 +8,10 @@
* sharedobject.cpp
*/
#include "sharedobject.h"
-#include "mutex.h"
+#include "mutex.h"
#include "uassert.h"
-#include "umutex.h"
-#include "unifiedcache.h"
+#include "umutex.h"
+#include "unifiedcache.h"
U_NAMESPACE_BEGIN
@@ -20,28 +20,28 @@ SharedObject::~SharedObject() {}
UnifiedCacheBase::~UnifiedCacheBase() {}
void
-SharedObject::addRef() const {
- umtx_atomic_inc(&hardRefCount);
+SharedObject::addRef() const {
+ umtx_atomic_inc(&hardRefCount);
}
-// removeRef Decrement the reference count and delete if it is zero.
-// Note that SharedObjects with a non-null cachePtr are owned by the
-// unified cache, and the cache will be responsible for the actual deletion.
-// The deletion could be as soon as immediately following the
-// update to the reference count, if another thread is running
-// a cache eviction cycle concurrently.
-// NO ACCESS TO *this PERMITTED AFTER REFERENCE COUNT == 0 for cached objects.
-// THE OBJECT MAY ALREADY BE GONE.
+// removeRef Decrement the reference count and delete if it is zero.
+// Note that SharedObjects with a non-null cachePtr are owned by the
+// unified cache, and the cache will be responsible for the actual deletion.
+// The deletion could be as soon as immediately following the
+// update to the reference count, if another thread is running
+// a cache eviction cycle concurrently.
+// NO ACCESS TO *this PERMITTED AFTER REFERENCE COUNT == 0 for cached objects.
+// THE OBJECT MAY ALREADY BE GONE.
void
-SharedObject::removeRef() const {
- const UnifiedCacheBase *cache = this->cachePtr;
- int32_t updatedRefCount = umtx_atomic_dec(&hardRefCount);
- U_ASSERT(updatedRefCount >= 0);
- if (updatedRefCount == 0) {
- if (cache) {
- cache->handleUnreferencedObject();
+SharedObject::removeRef() const {
+ const UnifiedCacheBase *cache = this->cachePtr;
+ int32_t updatedRefCount = umtx_atomic_dec(&hardRefCount);
+ U_ASSERT(updatedRefCount >= 0);
+ if (updatedRefCount == 0) {
+ if (cache) {
+ cache->handleUnreferencedObject();
} else {
- delete this;
+ delete this;
}
}
}
@@ -54,7 +54,7 @@ SharedObject::getRefCount() const {
void
SharedObject::deleteIfZeroRefCount() const {
- if (this->cachePtr == nullptr && getRefCount() == 0) {
+ if (this->cachePtr == nullptr && getRefCount() == 0) {
delete this;
}
}