示例#1
0
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);
}
示例#2
0
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);
}
示例#3
0
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);
}
示例#4
0
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);
}
示例#5
0
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);
}
示例#6
0
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--;
}
示例#7
0
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);
}
示例#8
0
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);
}