// 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 { deletethis;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.