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


C++ STAILQ_INSERT_TAIL函数代码示例

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


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

示例1: elf_strtab_create

elf_strtab_head *
elf_strtab_create()
{
    elf_strtab_head *strtab = yasm_xmalloc(sizeof(elf_strtab_head));
    elf_strtab_entry *entry = yasm_xmalloc(sizeof(elf_strtab_entry));

    STAILQ_INIT(strtab);
    entry->index = 0;
    entry->str = yasm__xstrdup("");

    STAILQ_INSERT_TAIL(strtab, entry, qlink);
    return strtab;
}
开发者ID:Acidburn0zzz,项目名称:yasm,代码行数:13,代码来源:elf.c

示例2: seq_alloc

struct instruction *
seq_alloc()
{
	struct instruction *new_instr;

	new_instr = (struct instruction *)malloc(sizeof(struct instruction));
	if (new_instr == NULL)
		stop("Unable to malloc instruction object", EX_SOFTWARE);
	memset(new_instr, 0, sizeof(*new_instr));
	STAILQ_INSERT_TAIL(&seq_program, new_instr, links);
	new_instr->srcline = yylineno;
	return new_instr;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:13,代码来源:aicasm.c

示例3: rte_vmbus_subchan_open

/* Setup secondary channel */
int rte_vmbus_subchan_open(struct vmbus_channel *primary,
			   struct vmbus_channel **new_chan)
{
	struct vmbus_channel *chan;
	int err;

	err = vmbus_uio_get_subchan(primary, &chan);
	if (err)
		return err;

	STAILQ_INSERT_TAIL(&primary->subchannel_list, chan, next);
	*new_chan = chan;
	return 0;
}
开发者ID:DrenfongWong,项目名称:dpdk,代码行数:15,代码来源:vmbus_channel.c

示例4: pcpu_init

/*
 * Initialize the MI portions of a struct pcpu.
 */
void
pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{

	bzero(pcpu, size);
	KASSERT(cpuid >= 0 && cpuid < MAXCPU,
	    ("pcpu_init: invalid cpuid %d", cpuid));
	pcpu->pc_cpuid = cpuid;
	cpuid_to_pcpu[cpuid] = pcpu;
	STAILQ_INSERT_TAIL(&cpuhead, pcpu, pc_allcpu);
	cpu_pcpu_init(pcpu, cpuid, size);
	pcpu->pc_rm_queue.rmq_next = &pcpu->pc_rm_queue;
	pcpu->pc_rm_queue.rmq_prev = &pcpu->pc_rm_queue;
}
开发者ID:coyizumi,项目名称:cs111,代码行数:17,代码来源:subr_pcpu.c

示例5: dwarf_add_frame_fde_b

Dwarf_Unsigned
dwarf_add_frame_fde_b(Dwarf_P_Debug dbg, Dwarf_P_Fde fde, Dwarf_P_Die die,
    Dwarf_Unsigned cie, Dwarf_Addr virt_addr, Dwarf_Unsigned code_len,
    Dwarf_Unsigned symbol_index, Dwarf_Unsigned end_symbol_index,
    Dwarf_Addr offset_from_end_sym, Dwarf_Error *error)
{
	Dwarf_P_Cie ciep;
	int i;

	/*
	 * XXX SGI libdwarf need the DIE arg because later it will insert a
	 * DW_AT_MIPS_fde attribute, which points to the offset the
	 * correspoding FDE, into this DIE. Do we need this?
	 */
	(void) die;

	if (dbg == NULL || fde == NULL || fde->fde_dbg != dbg) {
		DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
		return (DW_DLV_NOCOUNT);
	}

	ciep = STAILQ_FIRST(&dbg->dbgp_cielist);
	for (i = 0; (Dwarf_Unsigned) i < cie; i++) {
		ciep = STAILQ_NEXT(ciep, cie_next);
		if (ciep == NULL)
			break;
	}
	if (ciep == NULL) {
		DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
		return (DW_DLV_NOCOUNT);
	}

	if (end_symbol_index > 0 &&
	    (dbg->dbgp_flags & DW_DLC_SYMBOLIC_RELOCATIONS) == 0) {
		DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
		return (DW_DLV_NOCOUNT);
	}

	fde->fde_cie = ciep;
	fde->fde_initloc = virt_addr;
	fde->fde_adrange = code_len;
	fde->fde_symndx = symbol_index;
	fde->fde_esymndx = end_symbol_index;
	fde->fde_eoff = offset_from_end_sym;

	STAILQ_INSERT_TAIL(&dbg->dbgp_fdelist, fde, fde_next);

	return (dbg->dbgp_fdelen++);
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:49,代码来源:dwarf_pro_frame.c

示例6: add_pattern

/*
 * Add an entry to a pattern list
 */
static void
add_pattern(struct pattern_list *list, const char *pattern)
{
	struct pattern *entry;
	size_t len;

	debug("adding pattern '%s'\n", pattern);
	len = strlen(pattern);
	if ((entry = malloc(sizeof *entry + len + 1)) == NULL) {
		errno = ENOMEM;
		error("malloc()");
	}
	memcpy(entry->pattern, pattern, len + 1);
	STAILQ_INSERT_TAIL(list, entry, link);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:18,代码来源:unzip.c

示例7: conn_put

void
conn_put(struct conn *c)
{
    log_debug(LOG_VVERB, "put conn %p c %d", c, c->sd);

    if (c->rsize > RSIZE_HIGHWAT) {
        conn_free(c);
        return;
    }

    pthread_mutex_lock(&free_connq_mutex);
    nfree_connq++;
    STAILQ_INSERT_TAIL(&free_connq, c, c_tqe);
    pthread_mutex_unlock(&free_connq_mutex);
}
开发者ID:AllenDou,项目名称:twemcache,代码行数:15,代码来源:mc_connection.c

示例8: get_entry_s

static inline entry_s* get_entry_s(int row, int col, double value) {
	int i;
	entry_s *entry;
	if (STAILQ_EMPTY(&free_entries_s)) {
		for (i = 19; i>=0; i--) {
			entry = (entry_s*)malloc(sizeof(entry_s));
			if (!entry) return NULL;
			if (i) STAILQ_INSERT_TAIL(&free_entries_s, entry, hook);
		}
	} else {
		entry = STAILQ_FIRST(&free_entries_s);
		STAILQ_REMOVE_HEAD(&free_entries_s, hook);
	}
	return entry;
}
开发者ID:fluxid,项目名称:flantob,代码行数:15,代码来源:cstuff.c

示例9: mpc_url_task_insert

void
mpc_url_task_insert(mpc_url_t *mpc_url)
{
    pthread_mutex_lock(&mutex_task);

    STAILQ_INSERT_TAIL(&mpc_url_task_queue, mpc_url, next);
    mpc_url_ntask++;
    /*
    mpc_log_debug(0, "insert task url(%d), total %d, host: \"%V\" uri: \"%V\"",
                  mpc_url->url_id, mpc_url_ntask, 
                  &mpc_url->host, &mpc_url->uri);
                  */

    pthread_mutex_unlock(&mutex_task);
}
开发者ID:flygoast,项目名称:mpc,代码行数:15,代码来源:mpc_url.c

示例10: lazfs_workq_run

void
lazfs_workq_run(lazfs_workq_t *workq, lazfs_workq_job_t *job)
{
	int err;

	assert(workq != NULL);
	assert(job != NULL);

	LOCK(workq->lock);
	STAILQ_INSERT_TAIL(&workq->jobs, job, link);

	err = pthread_cond_signal(&workq->cond);
	UNLOCK(workq->lock);
	assert(err == 0);
}
开发者ID:vonsch,项目名称:lazfs,代码行数:15,代码来源:workq.c

示例11: soaio_enqueue

void
soaio_enqueue(struct task *task)
{

	mtx_lock(&soaio_jobs_lock);
	MPASS(task->ta_pending == 0);
	task->ta_pending++;
	STAILQ_INSERT_TAIL(&soaio_jobs, task, ta_link);
	soaio_queued++;
	if (soaio_queued <= soaio_idle)
		wakeup_one(&soaio_idle);
	else if (soaio_num_procs < soaio_max_procs)
		taskqueue_enqueue(taskqueue_thread, &soaio_kproc_task);
	mtx_unlock(&soaio_jobs_lock);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:15,代码来源:sys_socket.c

示例12: register_notifier

int register_notifier(notifier client)
{

	struct notify_elem *newclient;

	if (!client)
		return -1;

	newclient = (struct notify_elem *)calloc(1, sizeof(struct notify_elem));
	newclient->client = client;

	STAILQ_INSERT_TAIL(&clients, newclient, next);

	return 0;
}
开发者ID:Chadizzm,项目名称:swupdate,代码行数:15,代码来源:notifier.c

示例13: comp_ac_add

/**
 * comp_ac_add - Add a Mailbox to a Account
 */
int comp_ac_add(struct Account *a, struct Mailbox *m)
{
  if (!a || !m)
    return -1;

  if (m->magic != MUTT_COMPRESSED)
    return -1;

  m->account = a;

  struct MailboxNode *np = mutt_mem_calloc(1, sizeof(*np));
  np->mailbox = m;
  STAILQ_INSERT_TAIL(&a->mailboxes, np, entries);
  return 0;
}
开发者ID:darnir,项目名称:neomutt,代码行数:18,代码来源:compress.c

示例14: main

int main(int argc, char **argv)
{
	int server_socket;
	struct sockaddr_storage their_addr; // connector's address information
	socklen_t sin_size;
	int new_fd;
	struct request *req;
	pthread_attr_t attr;
	pthread_t thread_id;
	int i;

	server_opts(argc, argv);
	server_socket = server_setup_socket();
	if (server_socket < 0) {
		exit(-1);
	}
	/* Initialize vars */
	STAILQ_INIT(&requestq);
	pthread_cond_init(&req_cond, NULL);

	/* Start the detached worker threads */
	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
	for (i = 0; i < workers; i++) {
		pthread_create(&thread_id, &attr, server_worker, NULL);
	}

	/* Accept connections */
	while (1) {
		sin_size = sizeof(their_addr);
		new_fd = accept(server_socket, (struct sockaddr *)&their_addr,
		    &sin_size);
		if (new_fd == -1) {
        	    perror("accept");
		    continue;
		}
		req = calloc(1, sizeof(struct request));
		if (!req) {
			perror("calloc");
		}
		req->fd = new_fd;
		pthread_mutex_lock(&req_mutex);
		STAILQ_INSERT_TAIL(&requestq, req, link);
		pthread_mutex_unlock(&req_mutex);
		pthread_cond_signal(&req_cond);
	}
	return 0;
}
开发者ID:jigarvora,项目名称:webclient_webserver,代码行数:48,代码来源:webserver.c

示例15: ntb_complete_rxc

static void
ntb_complete_rxc(void *arg, int pending)
{
	struct ntb_transport_qp *qp = arg;
	struct ntb_queue_entry *entry;
	struct mbuf *m;
	unsigned len;

	CTR0(KTR_NTB, "RX: rx_completion_task");

	mtx_lock_spin(&qp->ntb_rx_q_lock);

	while (!STAILQ_EMPTY(&qp->rx_post_q)) {
		entry = STAILQ_FIRST(&qp->rx_post_q);
		if ((entry->flags & IF_NTB_DESC_DONE_FLAG) == 0)
			break;

		entry->x_hdr->flags = 0;
		iowrite32(entry->index, &qp->rx_info->entry);

		STAILQ_REMOVE_HEAD(&qp->rx_post_q, entry);

		len = entry->len;
		m = entry->buf;

		/*
		 * Re-initialize queue_entry for reuse; rx_handler takes
		 * ownership of the mbuf.
		 */
		entry->buf = NULL;
		entry->len = transport_mtu;
		entry->cb_data = qp->transport->ifp;

		STAILQ_INSERT_TAIL(&qp->rx_pend_q, entry, entry);

		mtx_unlock_spin(&qp->ntb_rx_q_lock);

		CTR2(KTR_NTB, "RX: completing entry %p, mbuf %p", entry, m);
		if (qp->rx_handler != NULL && qp->client_ready)
			qp->rx_handler(qp, qp->cb_data, m, len);
		else
			m_freem(m);

		mtx_lock_spin(&qp->ntb_rx_q_lock);
	}

	mtx_unlock_spin(&qp->ntb_rx_q_lock);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:48,代码来源:if_ntb.c


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