/* * Call all handlers registered with __cxa_atexit for the shared * object owning 'dso'. Note: if 'dso' is NULL, then all remaining * handlers are called. */ void __cxa_finalize(void *dso) { struct dl_phdr_info phdr_info; struct atexit *p; struct atexit_fn fn; int n, has_phdr; if (dso != NULL) { has_phdr = _rtld_addr_phdr(dso, &phdr_info); } else { has_phdr = 0; global_exit = 1; } _MUTEX_LOCK(&atexit_mutex); for (p = __atexit; p; p = p->next) { for (n = p->ind; --n >= 0;) { if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) continue; /* already been called */ fn = p->fns[n]; if (dso != NULL && dso != fn.fn_dso) { /* wrong DSO ? */ if (!has_phdr || global_exit || !__elf_phdr_match_addr(&phdr_info, fn.fn_ptr.cxa_func)) continue; } /* Mark entry to indicate that this particular handler has already been called. */ p->fns[n].fn_type = ATEXIT_FN_EMPTY; _MUTEX_UNLOCK(&atexit_mutex); /* Call the function of correct type. */ if (fn.fn_type == ATEXIT_FN_CXA) fn.fn_ptr.cxa_func(fn.fn_arg); else if (fn.fn_type == ATEXIT_FN_STD) fn.fn_ptr.std_func(); _MUTEX_LOCK(&atexit_mutex); } } _MUTEX_UNLOCK(&atexit_mutex); if (dso == NULL) _MUTEX_DESTROY(&atexit_mutex); if (has_phdr && !global_exit && &__pthread_cxa_finalize != NULL) __pthread_cxa_finalize(&phdr_info); }
void my_rwlock_destroy(my_rwlock_t * my_rwlock) { int semrc = 0; _MUTEX_DESTROY(my_rwlock->protect_reader_count); semrc |= sem_destroy(&(my_rwlock->allow_readers)); if(semrc != 0) { LOCK_DEBUG("rc=%d [%s] RWLOCK DESTROY1", semrc, strerror(errno)); debug_crash(); } semrc |= sem_destroy(&(my_rwlock->no_processes)); if(semrc != 0) { LOCK_DEBUG("rc=%d [%s] RWLOCK DESTROY2", semrc, strerror(errno)); debug_crash(); } memset(my_rwlock, 0, sizeof(my_rwlock_t)); }
// Unlock the device void DeviceLockRelease(struct parsedname *pn) { if (pn->lock) { // this is the stored pointer to the device in the appropriate device tree // Free the device _MUTEX_UNLOCK(pn->lock->lock); /* Serg: This coredump on his 64-bit server */ // Now mark our disinterest in the device tree (and possibly reap the node)) DEVTREE_LOCK(pn); --pn->lock->users; // remove our interest if (pn->lock->users == 0) { // Nobody's interested! tdelete(pn->lock, &(pn->selected_connection->dev_db), dev_compare); /* Serg: Address 0x5A0D750 is 0 bytes inside a block of size 32 free'd */ _MUTEX_DESTROY(pn->lock->lock); owfree(pn->lock); } DEVTREE_UNLOCK(pn); pn->lock = NULL; } }
static void W1_monitor_close(struct connection_in *in) { _MUTEX_DESTROY(in->master.w1_monitor.seq_mutex); _MUTEX_DESTROY(in->master.w1_monitor.read_mutex); }