diff options
author | neksard <neksard@yandex-team.ru> | 2022-02-10 16:45:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:23 +0300 |
commit | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (patch) | |
tree | 83bf5c8c8047c42d8475e6095df90ccdc3d1b57f /contrib/libs/icu/common/sharedobject.cpp | |
parent | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (diff) | |
download | ydb-8f7cf138264e0caa318144bf8a2c950e0b0a8593.tar.gz |
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/common/sharedobject.cpp')
-rw-r--r-- | contrib/libs/icu/common/sharedobject.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/libs/icu/common/sharedobject.cpp b/contrib/libs/icu/common/sharedobject.cpp index 6eeca8605f..b18ae08556 100644 --- a/contrib/libs/icu/common/sharedobject.cpp +++ b/contrib/libs/icu/common/sharedobject.cpp @@ -1,29 +1,29 @@ // © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* Copyright (C) 2015, International Business Machines -* Corporation and others. All Rights Reserved. -****************************************************************************** -* sharedobject.cpp -*/ -#include "sharedobject.h" +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2015, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* sharedobject.cpp +*/ +#include "sharedobject.h" #include "mutex.h" -#include "uassert.h" +#include "uassert.h" #include "umutex.h" #include "unifiedcache.h" - -U_NAMESPACE_BEGIN - -SharedObject::~SharedObject() {} - -UnifiedCacheBase::~UnifiedCacheBase() {} - -void + +U_NAMESPACE_BEGIN + +SharedObject::~SharedObject() {} + +UnifiedCacheBase::~UnifiedCacheBase() {} + +void 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. @@ -32,7 +32,7 @@ SharedObject::addRef() const { // a cache eviction cycle concurrently. // NO ACCESS TO *this PERMITTED AFTER REFERENCE COUNT == 0 for cached objects. // THE OBJECT MAY ALREADY BE GONE. -void +void SharedObject::removeRef() const { const UnifiedCacheBase *cache = this->cachePtr; int32_t updatedRefCount = umtx_atomic_dec(&hardRefCount); @@ -40,23 +40,23 @@ SharedObject::removeRef() const { if (updatedRefCount == 0) { if (cache) { cache->handleUnreferencedObject(); - } else { + } else { delete this; - } - } -} - - -int32_t -SharedObject::getRefCount() const { - return umtx_loadAcquire(hardRefCount); -} - -void -SharedObject::deleteIfZeroRefCount() const { + } + } +} + + +int32_t +SharedObject::getRefCount() const { + return umtx_loadAcquire(hardRefCount); +} + +void +SharedObject::deleteIfZeroRefCount() const { if (this->cachePtr == nullptr && getRefCount() == 0) { - delete this; - } -} - -U_NAMESPACE_END + delete this; + } +} + +U_NAMESPACE_END |