void VRT_Vmod_Fini(struct vmod **hdl) { struct vmod *v; ASSERT_CLI(); TAKE_OBJ_NOTNULL(v, hdl, VMOD_MAGIC); #ifndef DONT_DLCLOSE_VMODS /* * atexit(3) handlers are not called during dlclose(3). We don't * normally use them, but we do when running GCOV. This option * enables us to do that. */ AZ(dlclose(v->hdl)); #endif if (--v->ref != 0) return; free(v->nm); free(v->path); VTAILQ_REMOVE(&vmods, v, list); VSC_C_main->vmods--; FREE_OBJ(v); }
void VRT_DelDirector(VCL_BACKEND *bp) { struct vcl *vcl; struct vcldir *vdir; VCL_BACKEND d; TAKE_OBJ_NOTNULL(d, bp, DIRECTOR_MAGIC); vdir = d->vdir; CHECK_OBJ_NOTNULL(vdir, VCLDIR_MAGIC); vcl = vdir->vcl; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); Lck_Lock(&vcl_mtx); VTAILQ_REMOVE(&vcl->director_list, vdir, list); Lck_Unlock(&vcl_mtx); AZ(errno=pthread_rwlock_rdlock(&vcl->temp_rwl)); if (VCL_WARM(vcl)) VDI_Event(d, VCL_EVENT_COLD); AZ(errno=pthread_rwlock_unlock(&vcl->temp_rwl)); if(vdir->methods->destroy != NULL) vdir->methods->destroy(d); free(vdir->cli_name); FREE_OBJ(vdir->dir); FREE_OBJ(vdir); }
void sharddir_delete(struct sharddir **sharddp) { struct sharddir *shardd; TAKE_OBJ_NOTNULL(shardd, sharddp, SHARDDIR_MAGIC); shardcfg_delete(shardd); AZ(pthread_rwlock_destroy(&shardd->mtx)); FREE_OBJ(shardd); }
void MPL_Destroy(struct mempool **mpp) { struct mempool *mpl; TAKE_OBJ_NOTNULL(mpl, mpp, MEMPOOL_MAGIC); Lck_Lock(&mpl->mtx); AZ(mpl->live); mpl->self_destruct = 1; Lck_Unlock(&mpl->mtx); }
void Waiter_Destroy(struct waiter **wp) { struct waiter *w; TAKE_OBJ_NOTNULL(w, wp, WAITER_MAGIC); AZ(binheap_root(w->heap)); AN(w->impl->fini); w->impl->fini(w); FREE_OBJ(w); }
void ObjDestroy(const struct worker *wrk, struct objcore **p) { struct objcore *oc; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); TAKE_OBJ_NOTNULL(oc, p, OBJCORE_MAGIC); if (oc->boc != NULL) obj_deleteboc(&oc->boc); FREE_OBJ(oc); wrk->stats->n_objectcore--; }
void vdir_delete(struct vdir **vdp) { struct vdir *vd; TAKE_OBJ_NOTNULL(vd, vdp, VDIR_MAGIC); AZ(vd->dir); free(vd->backend); free(vd->weight); AZ(pthread_rwlock_destroy(&vd->mtx)); vbit_destroy(vd->healthy); FREE_OBJ(vd); }
static void vxp_Delete(struct vxp **pvxp) { struct vxp *vxp; struct membit *mb; TAKE_OBJ_NOTNULL(vxp, pvxp, VXP_MAGIC); while (!VTAILQ_EMPTY(&vxp->membits)) { mb = VTAILQ_FIRST(&vxp->membits); VTAILQ_REMOVE(&vxp->membits, mb, list); free(mb->ptr); free(mb); } FREE_OBJ(vxp); }