void AmSafeDelete::Delete() { if (fRefCount <= 0) { // If nobody else has a reference on this event, it is // safe to just delete it. RealDelete(); } else { // Otherwise, set the mDeleted flag, avoiding any race // conditions with other threads that might have references. IncRefs(); fDeleted = 1; DecRefs(); } }
void __fastcall DZRawData::Release(void) { if (imp) { if (!DecRefs()) { /*void*/char *_imp = (char*)imp; imp = NULL; // free(_imp); delete[] _imp; } imp = NULL; } }
void AmSafeDelete::Undelete() { IncRefs(); fDeleted = 0; DecRefs(); }