diff options
author | vvvv <[email protected]> | 2022-03-19 03:08:17 +0300 |
---|---|---|
committer | vvvv <[email protected]> | 2022-03-19 03:08:17 +0300 |
commit | a5903a6577baec274cc9b12cb8f6310a6d909288 (patch) | |
tree | 691b05518934c908d56b814d9362ce70bcac0413 /contrib/libs/icu/common/sharedobject.cpp | |
parent | 91c4444d50a2eb5df5072ef181a6f2bd5471b77b (diff) |
don't export pg_wrapper in opensource build yet
ref:4e1943a79707d4ee2518b60ffd3919b3e6341d12
Diffstat (limited to 'contrib/libs/icu/common/sharedobject.cpp')
-rw-r--r-- | contrib/libs/icu/common/sharedobject.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/contrib/libs/icu/common/sharedobject.cpp b/contrib/libs/icu/common/sharedobject.cpp deleted file mode 100644 index 6eeca8605f0..00000000000 --- a/contrib/libs/icu/common/sharedobject.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// © 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" -#include "mutex.h" -#include "uassert.h" -#include "umutex.h" -#include "unifiedcache.h" - -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. -// 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(); - } else { - delete this; - } - } -} - - -int32_t -SharedObject::getRefCount() const { - return umtx_loadAcquire(hardRefCount); -} - -void -SharedObject::deleteIfZeroRefCount() const { - if (this->cachePtr == nullptr && getRefCount() == 0) { - delete this; - } -} - -U_NAMESPACE_END |