当前位置: 首页>>代码示例>>C++>>正文


C++ VTAILQ_REMOVE函数代码示例

本文整理汇总了C++中VTAILQ_REMOVE函数的典型用法代码示例。如果您正苦于以下问题:C++ VTAILQ_REMOVE函数的具体用法?C++ VTAILQ_REMOVE怎么用?C++ VTAILQ_REMOVE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VTAILQ_REMOVE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vwk_sess_ev

static void
vwk_sess_ev(struct vwk *vwk, const struct kevent *kp, double now)
{
	struct sess *sp;

	AN(kp->udata);
	assert(kp->udata != vwk->pipes);
	CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC);
	DSL(DBG_WAITER, sp->vxid, "KQ: sp %p kev data %lu flags 0x%x%s",
	    sp, (unsigned long)kp->data, kp->flags,
	    (kp->flags & EV_EOF) ? " EOF" : "");

	if (kp->data > 0) {
		VTAILQ_REMOVE(&vwk->sesshead, sp, list);
		SES_Handle(sp, now);
		return;
	} else if (kp->flags & EV_EOF) {
		VTAILQ_REMOVE(&vwk->sesshead, sp, list);
		SES_Delete(sp, SC_REM_CLOSE, now);
		return;
	} else {
		VSL(SLT_Debug, sp->vxid,
		    "KQ: sp %p kev data %lu flags 0x%x%s",
		    sp, (unsigned long)kp->data, kp->flags,
		    (kp->flags & EV_EOF) ? " EOF" : "");
	}
}
开发者ID:Open-Party,项目名称:Varnish-Cache,代码行数:27,代码来源:cache_waiter_kqueue.c

示例2: vca_kev

static void
vca_kev(const struct kevent *kp)
{
    int i, j;
    struct sess *sp;
    struct sess *ss[NKEV];

    AN(kp->udata);
    if (kp->udata == vca_pipes) {
        j = 0;
        i = read(vca_pipes[0], ss, sizeof ss);
        if (i == -1 && errno == EAGAIN)
            return;
        while (i >= sizeof ss[0]) {
            CHECK_OBJ_NOTNULL(ss[j], SESS_MAGIC);
            assert(ss[j]->sp_fd >= 0);
            AZ(ss[j]->obj);
            VTAILQ_INSERT_TAIL(&sesshead, ss[j], list);
            vca_kq_sess(ss[j], EV_ADD | EV_ONESHOT);
            j++;
            i -= sizeof ss[0];
        }
        assert(i == 0);
        return;
    }
    CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC);
    DSL(0x04, SLT_Debug, sp->id, "KQ: sp %p kev data %lu flags 0x%x%s",
        sp, (unsigned long)kp->data, kp->flags,
        (kp->flags & EV_EOF) ? " EOF" : "");

    assert(sp->id == kp->ident);
    assert(sp->sp_fd == sp->id);
    if (kp->data > 0) {
        i = HTC_Rx(sp->htc);
        if (i == 0) {
            vca_kq_sess(sp, EV_ADD | EV_ONESHOT);
            return;	/* more needed */
        }
        VTAILQ_REMOVE(&sesshead, sp, list);
        vca_handover(sp, i);
        return;
    } else if (kp->flags & EV_EOF) {
        VTAILQ_REMOVE(&sesshead, sp, list);
        vca_close_session(sp, "EOF");
        SES_Delete(sp);
        return;
    } else {
        VSL(SLT_Debug, sp->id, "KQ: sp %p kev data %lu flags 0x%x%s",
            sp, (unsigned long)kp->data, kp->flags,
            (kp->flags & EV_EOF) ? " EOF" : "");
    }
}
开发者ID:smallvil,项目名称:Cache-Terminator,代码行数:52,代码来源:cache_waiter_kqueue.c

示例3: vca_port_ev

static inline void
vca_port_ev(port_event_t *ev) {
	struct sess *sp;
	if(ev->portev_source == PORT_SOURCE_USER) {
		CAST_OBJ_NOTNULL(sp, ev->portev_user, SESS_MAGIC);
		assert(sp->fd >= 0);
		AZ(sp->obj);
		VTAILQ_INSERT_TAIL(&sesshead, sp, list);
		vca_add(sp->fd, sp);
	} else {
		int i;
		assert(ev->portev_source == PORT_SOURCE_FD);
		CAST_OBJ_NOTNULL(sp, ev->portev_user, SESS_MAGIC);
		assert(sp->fd >= 0);
		if(ev->portev_events & POLLERR) {
			vca_del(sp->fd);
			VTAILQ_REMOVE(&sesshead, sp, list);			
			vca_close_session(sp, "EOF");
			SES_Delete(sp);
			return;
		}
		i = HTC_Rx(sp->htc);

		if (i == 0) {
			/* incomplete header, wait for more data */
			vca_add(sp->fd, sp);
			return;
		}

		/* 
		 * note: the original man page for port_associate(3C) states:
		 *
		 *    When an event for a PORT_SOURCE_FD object is retrieved,
		 *    the object no longer has an association with the port.
		 *
		 * This can be read along the lines of sparing the
		 * port_dissociate after port_getn(), but in fact,
		 * port_dissociate should be used
		 *
		 * Ref: http://opensolaris.org/jive/thread.jspa?threadID=129476&tstart=0
		 */
		vca_del(sp->fd);
		VTAILQ_REMOVE(&sesshead, sp, list);

		/* vca_handover will also handle errors */
		vca_handover(sp, i);
	}
	return;
}
开发者ID:smallvil,项目名称:Cache-Terminator,代码行数:49,代码来源:cache_waiter_ports.c

示例4: vca_eev

static void
vca_eev(const struct epoll_event *ep)
{
	struct sess *ss[NEEV], *sp;
	int i, j;

	AN(ep->data.ptr);
	if (ep->data.ptr == vca_pipes) {
		if (ep->events & EPOLLIN || ep->events & EPOLLPRI) {
			j = 0;
			i = read(vca_pipes[0], ss, sizeof ss);
			if (i == -1 && errno == EAGAIN)
				return;
			while (i >= sizeof ss[0]) {
				CHECK_OBJ_NOTNULL(ss[j], SESS_MAGIC);
				assert(ss[j]->fd >= 0);
				AZ(ss[j]->obj);
				VTAILQ_INSERT_TAIL(&sesshead, ss[j], list);
				vca_cond_modadd(ss[j]->fd, ss[j]);
				j++;
				i -= sizeof ss[0];
			}
			assert(i == 0);
		}
	} else {
		CAST_OBJ_NOTNULL(sp, ep->data.ptr, SESS_MAGIC);
		if (ep->events & EPOLLIN || ep->events & EPOLLPRI) {
			i = HTC_Rx(sp->htc);
			if (i == 0) {
				vca_modadd(sp->fd, sp, EPOLL_CTL_MOD);
				return;	/* more needed */
			}
			VTAILQ_REMOVE(&sesshead, sp, list);
			vca_handover(sp, i);
		} else if (ep->events & EPOLLERR) {
			VTAILQ_REMOVE(&sesshead, sp, list);
			vca_close_session(sp, "ERR");
			SES_Delete(sp);
		} else if (ep->events & EPOLLHUP) {
			VTAILQ_REMOVE(&sesshead, sp, list);
			vca_close_session(sp, "HUP");
			SES_Delete(sp);
		} else if (ep->events & EPOLLRDHUP) {
			VTAILQ_REMOVE(&sesshead, sp, list);
			vca_close_session(sp, "RHUP");
			SES_Delete(sp);
		}
	}
}
开发者ID:UsabilityDynamics,项目名称:node-varnish-service,代码行数:49,代码来源:cache_waiter_epoll.c

示例5: ban_cleantail

static void
ban_cleantail(void)
{
	struct ban *b;

	do {
		Lck_Lock(&ban_mtx);
		b = VTAILQ_LAST(&ban_head, banhead_s);
		if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
			if (b->flags & BANS_FLAG_COMPLETED)
				VSC_C_main->bans_completed--;
			if (b->flags & BANS_FLAG_OBJ)
				VSC_C_main->bans_obj--;
			if (b->flags & BANS_FLAG_REQ)
				VSC_C_main->bans_req--;
			VSC_C_main->bans--;
			VSC_C_main->bans_deleted++;
			VTAILQ_REMOVE(&ban_head, b, list);
			VSC_C_main->bans_persisted_fragmentation +=
			    ban_len(b->spec);
			ban_info(BI_DROP, b->spec, ban_len(b->spec));
		} else {
			b = NULL;
		}
		Lck_Unlock(&ban_mtx);
		if (b != NULL)
			BAN_Free(b);
	} while (b != NULL);
}
开发者ID:daghf,项目名称:varnish-cache-oldfork,代码行数:29,代码来源:cache_ban_lurker.c

示例6: Marg_connect

Marg_connect(const struct vev *e, int what)
{
	struct vsb *vsb;
	struct m_addr *ma;

	assert(e == M_conn);
	(void)what;

	M_fd = VTCP_connected(M_fd);
	if (M_fd < 0) {
		MGT_complain(C_INFO, "Could not connect to CLI-master: %m");
		ma = VTAILQ_FIRST(&m_addr_list);
		AN(ma);
		VTAILQ_REMOVE(&m_addr_list, ma, list);
		VTAILQ_INSERT_TAIL(&m_addr_list, ma, list);
		if (M_poll < 10)
			M_poll++;
		return (1);
	}
	vsb = sock_id("master", M_fd);
	mgt_cli_setup(M_fd, M_fd, 0, VSB_data(vsb), Marg_closer, NULL);
	VSB_destroy(&vsb);
	M_poll = 1;
	return (1);
}
开发者ID:ElijahLynn,项目名称:Varnish-Cache,代码行数:25,代码来源:mgt_cli.c

示例7: vsmw_delseg

static void
vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg, int fixidx)
{
	char *t = NULL;
	ssize_t s;
	int fd;

	CHECK_OBJ_NOTNULL(vsmw, VSMW_MAGIC);
	CHECK_OBJ_NOTNULL(seg, VSMWSEG_MAGIC);

	VTAILQ_REMOVE(&vsmw->segs, seg, list);
	REPLACE(seg->class, NULL);
	REPLACE(seg->id, NULL);
	FREE_OBJ(seg);

	if (fixidx) {
		vsmw_mkent(vsmw, vsmw->idx);
		REPLACE(t, VSB_data(vsmw->vsb));
		AN(t);
		fd = openat(vsmw->vdirfd,
		    t, O_WRONLY|O_CREAT|O_EXCL, vsmw->mode);
		assert(fd >= 0);
		vsmw_idx_head(vsmw, fd);
		VSB_clear(vsmw->vsb);
		VTAILQ_FOREACH(seg, &vsmw->segs, list)
			vsmw_fmt_index(vsmw, seg);
		AZ(VSB_finish(vsmw->vsb));
		s = write(fd, VSB_data(vsmw->vsb), VSB_len(vsmw->vsb));
		assert(s == VSB_len(vsmw->vsb));
		AZ(close(fd));
		AZ(renameat(vsmw->vdirfd, t, vsmw->vdirfd, vsmw->idx));
		REPLACE(t, NULL);
	}
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:34,代码来源:common_vsmw.c

示例8: _callout_reset

int
_callout_reset(struct callout_block *cb, struct callout *c, int to_ticks,
    void (*ftn)(void *), void *arg, const char *d_func, int d_line)
{
	int cancelled = 0;

	if (c->c_flags & CALLOUT_PENDING) {
		if (cb->nextsoftcheck == c)
			cb->nextsoftcheck = VTAILQ_NEXT(c, c_links.tqe);
		VTAILQ_REMOVE(&cb->callwheel[c->c_time & cb->callwheelmask], c,
		    c_links.tqe);
		cancelled = 1;
	}

	if (to_ticks <= 0)
		to_ticks = 1;

	c->magic = CALLOUT_MAGIC;
	c->c_arg = arg;
	c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING);
	c->c_func = ftn;
	c->c_time = cb->ticks + to_ticks;
	c->d_func = d_func;
	c->d_line = d_line;
	VTAILQ_INSERT_TAIL(&cb->callwheel[c->c_time & cb->callwheelmask],
	    c, c_links.tqe);
	if (callout_debug)
		fprintf(stdout,
		    "%sscheduled %p func %p arg %p in %d",
		    cancelled ? "re" : "", c, c->c_func, c->c_arg, to_ticks);

	return (cancelled);
}
开发者ID:weongyo,项目名称:varnish-perf,代码行数:33,代码来源:vcallout.c

示例9: _callout_stop_safe

int
_callout_stop_safe(struct callout_block *cb, struct callout *c)
{

	/*
	 * If the callout isn't pending, it's not on the queue, so
	 * don't attempt to remove it from the queue.  We can try to
	 * stop it by other means however.
	 */
	if (!(c->c_flags & CALLOUT_PENDING)) {
		c->c_flags &= ~CALLOUT_ACTIVE;
		if (callout_debug)
			fprintf(stdout,
			    "failed to stop %p func %p arg %p",
			    c, c->c_func, c->c_arg);
		return (0);
	}

	c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING);

	if (cb->nextsoftcheck == c)
		cb->nextsoftcheck = VTAILQ_NEXT(c, c_links.tqe);
	VTAILQ_REMOVE(&cb->callwheel[c->c_time & cb->callwheelmask], c,
	    c_links.tqe);

	if (callout_debug)
		fprintf(stderr, "cancelled %p func %p arg %p",
		    c, c->c_func, c->c_arg);
	return (1);
}
开发者ID:weongyo,项目名称:varnish-perf,代码行数:30,代码来源:vcallout.c

示例10: extmacro_def

void
extmacro_def(const char *name, const char *fmt, ...)
{
	char buf[256];
	struct extmacro *m;
	va_list ap;

	VTAILQ_FOREACH(m, &extmacro_list, list)
		if (!strcmp(name, m->name))
			break;
	if (m == NULL && fmt != NULL) {
		m = calloc(sizeof *m, 1);
		AN(m);
		REPLACE(m->name, name);
		VTAILQ_INSERT_TAIL(&extmacro_list, m, list);
	}
	if (fmt != NULL) {
		AN(m);
		va_start(ap, fmt);
		free(m->val);
		vbprintf(buf, fmt, ap);
		va_end(ap);
		m->val = strdup(buf);
		AN(m->val);
	} else if (m != NULL) {
		VTAILQ_REMOVE(&extmacro_list, m, list);
		free(m->name);
		free(m->val);
		free(m);
	}
}
开发者ID:BMDan,项目名称:Varnish-Cache,代码行数:31,代码来源:vtc.c

示例11: EXP_Touch

int
EXP_Touch(const struct object *o)
{
	struct objcore *oc;
	int retval = 0;
	struct objcore_head *lru;

	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
	oc = o->objcore;
	if (oc == NULL)
		return (retval);
	lru = STV_lru(o->objstore);
	if (lru == NULL)
		return (retval);
	AN(o->objhead);
	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
	if (Lck_Trylock(&exp_mtx))
		return (retval);
	if (oc->flags & OC_F_ONLRU) {
		VTAILQ_REMOVE(lru, oc, lru_list);
		VTAILQ_INSERT_TAIL(lru, oc, lru_list);
		VSL_stats->n_lru_moved++;
		retval = 1;
	}
	Lck_Unlock(&exp_mtx);
	return (retval);
}
开发者ID:akrito,项目名称:Varnish-Least-Busy-Director,代码行数:27,代码来源:cache_expire.c

示例12: Pool_Task_Arg

int
Pool_Task_Arg(struct worker *wrk, task_func_t *func,
    const void *arg, size_t arg_len)
{
	struct pool *pp;
	struct worker *wrk2;
	int retval;

	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
	AN(arg);
	AN(arg_len);
	pp = wrk->pool;
	CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);

	Lck_Lock(&pp->mtx);
	wrk2 = pool_getidleworker(pp);
	if (wrk2 != NULL) {
		VTAILQ_REMOVE(&pp->idle_queue, &wrk2->task, list);
		retval = 1;
	} else {
		wrk2 = wrk;
		retval = 0;
	}
	Lck_Unlock(&pp->mtx);
	AZ(wrk2->task.func);

	assert(arg_len <= WS_Reserve(wrk2->aws, arg_len));
	memcpy(wrk2->aws->f, arg, arg_len);
	wrk2->task.func = func;
	wrk2->task.priv = wrk2->aws->f;
	if (retval)
		AZ(pthread_cond_signal(&wrk2->cond));
	return (retval);
}
开发者ID:wskuner,项目名称:Varnish-Cache,代码行数:34,代码来源:cache_pool.c

示例13: VRT_DelDirector

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);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:26,代码来源:cache_vrt_vcl.c

示例14: VRT_rel_vcl

void
VRT_rel_vcl(VRT_CTX, struct vclref **refp)
{
	struct vcl *vcl;
	struct vclref *ref;

	AN(refp);
	ref = *refp;
	*refp = NULL;

	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
	CHECK_OBJ_NOTNULL(ref, VCLREF_MAGIC);

	vcl = ctx->vcl;
	CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
	assert(vcl == ref->vcl);

	/* NB: A VCL may be released by a VMOD at any time, but it must happen
	 * after a warmup and before the end of a cooldown. The release may or
	 * may not happen while the same thread holds the temperature lock, so
	 * instead we check that all references are gone in VCL_Nuke.
	 */

	Lck_Lock(&vcl_mtx);
	assert(!VTAILQ_EMPTY(&vcl->ref_list));
	VTAILQ_REMOVE(&vcl->ref_list, ref, list);
	vcl->nrefs--;
	/* No garbage collection here, for the same reasons as in VCL_Rel. */
	Lck_Unlock(&vcl_mtx);

	FREE_OBJ(ref);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:32,代码来源:cache_vrt_vcl.c

示例15: VRT_Vmod_Fini

void
VRT_Vmod_Fini(void **hdl)
{
	struct vmod *v;

	ASSERT_CLI();

	AN(*hdl);
	CAST_OBJ_NOTNULL(v, *hdl, VMOD_MAGIC);
	*hdl = NULL;

#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);
}
开发者ID:biddyweb,项目名称:Varnish-Cache,代码行数:27,代码来源:cache_vrt_vmod.c


注:本文中的VTAILQ_REMOVE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。