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


C++ TAILQ_INSERT_HEAD函数代码示例

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


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

示例1: pktref_insert_head

void
pktref_insert_head(struct th_pktref_queue *q, th_pkt_t *pkt)
{
  th_pktref_t *pr;

  pr = pktref_create(pkt);
  TAILQ_INSERT_HEAD(q, pr, pr_link);
}
开发者ID:swegener,项目名称:tvheadend,代码行数:8,代码来源:packet.c

示例2: bioq_insert_head

void
bioq_insert_head(struct bio_queue_head *head, struct bio *bp)
{

	if (head->insert_point == NULL)
		head->last_offset = bp->bio_offset;
	TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:8,代码来源:subr_disk.c

示例3: pmclog_deconfigure_log

int
pmclog_deconfigure_log(struct pmc_owner *po)
{
	int error;
	struct pmclog_buffer *lb;

	PMCDBG(LOG,CFG,1, "de-config po=%p", po);

	if ((po->po_flags & PMC_PO_OWNS_LOGFILE) == 0)
		return (EINVAL);

	KASSERT(po->po_sscount == 0,
	    ("[pmclog,%d] po=%p still owning SS PMCs", __LINE__, po));
	KASSERT(po->po_file != NULL,
	    ("[pmclog,%d] po=%p no log file", __LINE__, po));

	/* stop the kthread, this will reset the 'OWNS_LOGFILE' flag */
	pmclog_stop_kthread(po);

	KASSERT(po->po_kthread == NULL,
	    ("[pmclog,%d] po=%p kthread not stopped", __LINE__, po));

	/* return all queued log buffers to the global pool */
	while ((lb = TAILQ_FIRST(&po->po_logbuffers)) != NULL) {
		TAILQ_REMOVE(&po->po_logbuffers, lb, plb_next);
		PMCLOG_INIT_BUFFER_DESCRIPTOR(lb);
		mtx_lock_spin(&pmc_bufferlist_mtx);
		TAILQ_INSERT_HEAD(&pmc_bufferlist, lb, plb_next);
		mtx_unlock_spin(&pmc_bufferlist_mtx);
	}

	/* return the 'current' buffer to the global pool */
	if ((lb = po->po_curbuf) != NULL) {
		PMCLOG_INIT_BUFFER_DESCRIPTOR(lb);
		mtx_lock_spin(&pmc_bufferlist_mtx);
		TAILQ_INSERT_HEAD(&pmc_bufferlist, lb, plb_next);
		mtx_unlock_spin(&pmc_bufferlist_mtx);
	}

	/* drop a reference to the fd */
	error = fdrop(po->po_file, curthread);
	po->po_file  = NULL;
	po->po_error = 0;

	return (error);
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:46,代码来源:hwpmc_logging.c

示例4: genlist_insert

struct genlist_entry *
genlist_insert (struct genlist *head, void *data)
{
	struct genlist_entry *entry = calloc(sizeof(struct genlist_entry), 1);
	entry->data = data;
	TAILQ_INSERT_HEAD(head, entry, chain);
	return entry;
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:8,代码来源:genlist.c

示例5: add_to_queue

/* Function add_to_queue
 * Given a string representing a graph, the string will be added to the queue
 * graph: the string representing the graph 
*/
void add_to_queue(char * graph){
    struct entry *elem;
    elem = malloc(sizeof(struct entry));
    if(elem){
        elem->graph_text = graph;
    }
    TAILQ_INSERT_HEAD(&head, elem, entries);
}
开发者ID:deanaarons,项目名称:graphic-gray-code,代码行数:12,代码来源:task_gen.c

示例6: gg_dialog_cls

static void gg_dialog_cls(gg_dialog_t *dialog)
{
	if ((dialog->flags & GG_DIALOG_AUTOHIDE_PARENT) && dialog->parent_dialog)
		dialog->parent_dialog->flags &= ~GG_DIALOG_HIDDEN;

	TAILQ_REMOVE(&dialogs, dialog, entries);
	TAILQ_INSERT_HEAD(&closed_dialogs, dialog, entries);
}
开发者ID:konker,项目名称:dreamchess,代码行数:8,代码来源:dialog.c

示例7: dmsg_put

void
dmsg_put(struct dmsg *dmsg)
{
    log_debug(LOG_VVVERB, "put dmsg %p id %"PRIu64"", dmsg, dmsg->id);

    nfree_dmsgq++;
    TAILQ_INSERT_HEAD(&free_dmsgq, dmsg, m_tqe);
}
开发者ID:jasonly,项目名称:dynomite,代码行数:8,代码来源:dyn_dnode_msg.c

示例8: cmd_break_pane_exec

enum cmd_retval
cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args		*args = self->args;
	struct winlink		*wl;
	struct session		*s;
	struct window_pane	*wp;
	struct window		*w;
	char			*name;
	char			*cause;
	int			 base_idx;
	struct client		*c;
	struct format_tree	*ft;
	const char		*template;
	char			*cp;

	if ((wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp)) == NULL)
		return (CMD_RETURN_ERROR);

	if (window_count_panes(wl->window) == 1) {
		cmdq_error(cmdq, "can't break with only one pane");
		return (CMD_RETURN_ERROR);
	}

	w = wl->window;
	server_unzoom_window(w);

	TAILQ_REMOVE(&w->panes, wp, entry);
	if (wp == w->active) {
		w->active = w->last;
		w->last = NULL;
		if (w->active == NULL) {
			w->active = TAILQ_PREV(wp, window_panes, entry);
			if (w->active == NULL)
				w->active = TAILQ_NEXT(wp, entry);
		}
	} else if (wp == w->last)
		w->last = NULL;
	layout_close_pane(wp);

	w = wp->window = window_create1(s->sx, s->sy);
	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
	w->active = wp;
	name = default_window_name(w);
	window_set_name(w, name);
	free(name);
	layout_init(w, wp);

	base_idx = options_get_number(&s->options, "base-index");
	wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
	if (!args_has(self->args, 'd'))
		session_select(s, wl->idx);

	server_redraw_session(s);
	server_status_session_group(s);

	if (args_has(args, 'P')) {
		if ((template = args_get(args, 'F')) == NULL)
开发者ID:FauxFaux,项目名称:tmux,代码行数:58,代码来源:cmd-break-pane.c

示例9: cmd_break_pane_exec

enum cmd_retval
cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{
#ifdef TMATE_SLAVE
    return (CMD_RETURN_ERROR);
#else
    struct args		*args = self->args;
    struct winlink		*wl = cmdq->state.sflag.wl;
    struct session		*src_s = cmdq->state.sflag.s;
    struct session		*dst_s = cmdq->state.tflag.s;
    struct window_pane	*wp = cmdq->state.sflag.wp;
    struct window		*w = wl->window;
    char			*name;
    char			*cause;
    int			 idx = cmdq->state.tflag.idx;
    struct format_tree	*ft;
    const char		*template;
    char			*cp;

    if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) {
        cmdq_error(cmdq, "index %d already in use", idx);
        return (CMD_RETURN_ERROR);
    }

    if (window_count_panes(w) == 1) {
        cmdq_error(cmdq, "can't break with only one pane");
        return (CMD_RETURN_ERROR);
    }
    server_unzoom_window(w);

    TAILQ_REMOVE(&w->panes, wp, entry);
    window_lost_pane(w, wp);
    layout_close_pane(wp);

    w = wp->window = window_create1(dst_s->sx, dst_s->sy);
    TAILQ_INSERT_HEAD(&w->panes, wp, entry);
    w->active = wp;
    name = default_window_name(w);
    window_set_name(w, name);
    free(name);
    layout_init(w, wp);
    wp->flags |= PANE_CHANGED;

    if (idx == -1)
        idx = -1 - options_get_number(dst_s->options, "base-index");
    wl = session_attach(dst_s, w, idx, &cause); /* can't fail */
    if (!args_has(self->args, 'd'))
        session_select(dst_s, wl->idx);

    server_redraw_session(src_s);
    if (src_s != dst_s)
        server_redraw_session(dst_s);
    server_status_session_group(src_s);
    if (src_s != dst_s)
        server_status_session_group(dst_s);

    if (args_has(args, 'P')) {
        if ((template = args_get(args, 'F')) == NULL)
开发者ID:marcisme,项目名称:tmate-slave,代码行数:58,代码来源:cmd-break-pane.c

示例10: insert_con_into

/*
 * This function detaches 'con' from its parent and inserts it either before or
 * after 'target'.
 *
 */
static void insert_con_into(Con *con, Con *target, position_t position) {
    Con *parent = target->parent;
    /* We need to preserve the old con->parent. While it might still be used to
     * insert the entry before/after it, we call the on_remove_child callback
     * afterwards which might then close the con if it is empty. */
    Con *old_parent = con->parent;

    con_detach(con);
    con_fix_percent(con->parent);

    /* When moving to a workspace, we respect the user’s configured
     * workspace_layout */
    if (parent->type == CT_WORKSPACE) {
        Con *split = workspace_attach_to(parent);
        if (split != parent) {
            DLOG("Got a new split con, using that one instead\n");
            con->parent = split;
            con_attach(con, split, false);
            DLOG("attached\n");
            con->percent = 0.0;
            con_fix_percent(split);
            con = split;
            DLOG("ok, continuing with con %p instead\n", con);
            con_detach(con);
        }
    }

    con->parent = parent;

    if (position == BEFORE) {
        TAILQ_INSERT_BEFORE(target, con, nodes);
        TAILQ_INSERT_HEAD(&(parent->focus_head), con, focused);
    } else if (position == AFTER) {
        TAILQ_INSERT_AFTER(&(parent->nodes_head), target, con, nodes);
        TAILQ_INSERT_HEAD(&(parent->focus_head), con, focused);
    }

    /* Pretend the con was just opened with regards to size percent values.
     * Since the con is moved to a completely different con, the old value
     * does not make sense anyways. */
    con->percent = 0.0;
    con_fix_percent(parent);

    CALL(old_parent, on_remove_child);
}
开发者ID:Chr1stoph,项目名称:i3,代码行数:50,代码来源:move.c

示例11: spifi_free_scb

void
spifi_free_scb(struct spifi_softc *sc, struct spifi_scb *scb)
{
	int s;

	s = splbio();
	TAILQ_INSERT_HEAD(&sc->free_scb, scb, chain);
	splx(s);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:9,代码来源:spifi.c

示例12: amr_requeue_ccb

static __inline void
amr_requeue_ccb(struct amr_softc *sc, union ccb *ccb)
{
    int		s;

    s = splbio();
    TAILQ_INSERT_HEAD(&sc->amr_cam_ccbq, &ccb->ccb_h, sim_links.tqe);
    splx(s);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:9,代码来源:amr_cam.c

示例13: rd_lru_push

void rd_lru_push (rd_lru_t *rlru, void *ptr) {
	rd_lru_elm_t *rlrue;

	rlrue = calloc(1, sizeof(*rlrue));
	rlrue->rlrue_ptr = ptr;

	TAILQ_INSERT_HEAD(&rlru->rlru_elms, rlrue, rlrue_link);
	rlru->rlru_cnt++;
}
开发者ID:edenhill,项目名称:librd,代码行数:9,代码来源:rdlru.c

示例14: thread_init_function

void thread_init_function(void)
{
	if(!threadList.isInitialized)
	{

		threadList.isInitialized = TRUE;
		TAILQ_INIT(&threadList.list);
		TAILQ_INIT(&threadList.list_sleeping);
		TAILQ_INIT(&threadList.list_dead);

		atexit(threads_destroy);

		// il faut récupérer le contexte courant et le mettre dans threadList.mainThread, ainsi que l'ajouter
		thread_t thread = malloc(sizeof(struct thread_t_));
		if(thread == NULL)
		{
			perror("malloc");
			return;
		}

		#ifdef DEBUG_MODE
		thread->id = 0;
		thread->nb_calls = 0;
		#endif

		thread->state = READY;
		thread->retval = NULL;
		thread->default_priority = DEFAULT_PRIORITY;
		thread->current_priority = DEFAULT_PRIORITY;

		getcontext(&(thread->context));

		thread->valgrind_stackid = VALGRIND_STACK_REGISTER((thread->context).uc_stack.ss_sp,
								   (thread->context).uc_stack.ss_sp +
								   (thread->context).uc_stack.ss_size);


		threadList.max_priority = 1;
		threadList.mainThread = thread;
		threadList.currentThread = thread;
		TAILQ_INSERT_HEAD(&(threadList.list), thread, entries);


		getcontext(&return_t);
		return_t.uc_stack.ss_size = STACK_SIZE;
		return_t.uc_stack.ss_sp = malloc(STACK_SIZE);

		if(return_t.uc_stack.ss_sp == NULL)
		{
			perror("malloc");
			return;
		}

		return_t.uc_link = NULL;
		makecontext(&return_t, (void (*)(void))thread_return, 0);
	}
}
开发者ID:julienc91,项目名称:it202-projet-systeme,代码行数:57,代码来源:thread.c

示例15: recover_pts

static void
recover_pts(tsfix_t *tf, tfstream_t *tfs, th_pkt_t *pkt)
{
  th_pktref_t *pr, *srch;

  pktref_enqueue(&tf->tf_ptsq, pkt);

  while((pr = TAILQ_FIRST(&tf->tf_ptsq)) != NULL) {
    
    pkt = pr->pr_pkt;
    TAILQ_REMOVE(&tf->tf_ptsq, pr, pr_link);

    tfs = tfs_find(tf, pkt);

    switch(tfs->tfs_type) {

    case SCT_MPEG2VIDEO:

      switch(pkt->pkt_frametype) {
      case PKT_B_FRAME:
	/* B-frames have same PTS as DTS, pass them on */
	pkt->pkt_pts = pkt->pkt_dts;
	tsfixprintf("TSFIX: %-12s PTS b-frame set to %"PRId64"\n",
		    streaming_component_type2txt(tfs->tfs_type),
		    pkt->pkt_dts);
	break;
      
      case PKT_I_FRAME:
      case PKT_P_FRAME:
	/* Presentation occures at DTS of next I or P frame,
	   try to find it */
	TAILQ_FOREACH(srch, &tf->tf_ptsq, pr_link)
	  if (tfs_find(tf, srch->pr_pkt) == tfs &&
	      srch->pr_pkt->pkt_frametype <= PKT_P_FRAME) {
	    pkt->pkt_pts = srch->pr_pkt->pkt_dts;
	    tsfixprintf("TSFIX: %-12s PTS *-frame set to %"PRId64"\n",
			streaming_component_type2txt(tfs->tfs_type),
			pkt->pkt_pts);
	    break;
	  }
	if (srch == NULL) {
	  /* return packet back to tf_ptsq */
	  TAILQ_INSERT_HEAD(&tf->tf_ptsq, pr, pr_link);
	  return; /* not arrived yet, wait */
        }
      }
      break;

    default:
      break;
    }

    free(pr);
    normalize_ts(tf, tfs, pkt);
  }
}
开发者ID:JPP1,项目名称:tvheadend,代码行数:56,代码来源:tsfix.c


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