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


C++ queue_delete函数代码示例

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


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

示例1: main

int main(int argc, char const *argv[])
{
	void * queue;
	queue = queue_create();
	
	teacher_t t[50];

	for (int i = 0 ; i < 50; i++)
	{
		t[i].age = i;
		queue_insert(queue, &t[i]);
	}
	
	teacher_t * p;
	int k = queue_length(queue);
	for (int i = 0; i < k-1; i++)
	{
		p = (teacher_t *)queue_delete(queue);
		fprintf(stdout, "%d ", p->age);
	} 

	fprintf(stdout, "\n");

	p = (teacher_t *)queue_head(queue);
	fprintf(stdout, "%d ", p->age);
	fprintf(stdout, "\n");
	queue_delete(queue);

	for (int i = 0 ; i < 50; i++)
	{
		t[i].age = i + 100;
		queue_insert(queue, &t[i]);
	}
	if (!queue_empty(queue))
		fprintf(stdout, "queue is not empty\n");
	k = queue_length(queue);
	for (int i = 0; i < k; i++)
	{
		p = (teacher_t *)queue_delete(queue);
		fprintf(stdout, "%d ", p->age);
	} 
	fprintf(stdout, "\n");
	if (queue_empty(queue))
		fprintf(stdout, "queue not empty\n");

	queue_destroy(queue);
	return 0;
}
开发者ID:fonglee,项目名称:just_for_fun,代码行数:48,代码来源:test.c

示例2: ERR_FAIL_COND

void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_scene) {

	ERR_FAIL_COND(!is_inside_tree());

	Node *base = get_parent();
	if (!base)
		return;

	Ref<PackedScene> ps;
	if (p_custom_scene.is_valid())
		ps = p_custom_scene;
	else
		ps = ResourceLoader::load(path, "PackedScene");

	if (!ps.is_valid())
		return;
	Node *scene = ps->instance();
	scene->set_name(get_name());
	int pos = get_position_in_parent();

	for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
		scene->set(E->get().name, E->get().value);
	}

	queue_delete();

	base->remove_child(this);
	base->add_child(scene);
	base->move_child(scene, pos);
}
开发者ID:Alex-doc,项目名称:godot,代码行数:30,代码来源:instance_placeholder.cpp

示例3: queue_test_create

static void 
queue_test_create(void)
{
  queue_t q = queue_create(8);
  int i;
  double* d;

  assert(NULL != q);
  assert(queue_empty(q));

  srand(time(0));
  for (i = 0; i < 8; ++i) {
    d = (double*)malloc(sizeof(double));
    *d = rand() * 2322 * 0.12;
    queue_enqueue(q, d);
  }
  assert(!queue_empty(q));

  while (!queue_empty(q)) {
    d = queue_dequeue(q);
    free(d);
  }

  queue_delete(&q);

  fprintf(stdout, "Testing queue_create success ...\n");
}
开发者ID:hbfhaapy,项目名称:study,代码行数:27,代码来源:main.c

示例4: OS_milliseconds

char *iguana_blockingjsonstr(struct supernet_info *myinfo,char *jsonstr,uint64_t tag,int32_t maxmillis,char *remoteaddr)
{
    struct iguana_jsonitem *ptr; char *retjsonstr = 0; int32_t len,allocsize; double expiration;
    expiration = OS_milliseconds() + maxmillis;
    //printf("blocking case.(%s)\n",jsonstr);
    len = (int32_t)strlen(jsonstr);
    allocsize = sizeof(*ptr) + len + 1;
    ptr = mycalloc('J',1,allocsize);
    ptr->allocsize = allocsize;
    ptr->myinfo = myinfo;
    ptr->retjsonstrp = &retjsonstr;
    safecopy(ptr->remoteaddr,remoteaddr,sizeof(ptr->remoteaddr));
    memcpy(ptr->jsonstr,jsonstr,len+1);
    queue_enqueue("jsonQ",&jsonQ,&ptr->DL,0);
    while ( OS_milliseconds() < expiration )
    {
        usleep(100);
        if ( retjsonstr != 0 )
        {
            //printf("got blocking retjsonstr.(%s) delete allocsize.%d:%d\n",retjsonstr,allocsize,ptr->allocsize);
            queue_delete(&finishedQ,&ptr->DL,ptr->allocsize,1);
            return(retjsonstr);
        }
        usleep(1000);
    }
    //printf("(%s) expired\n",jsonstr);
    ptr->expired = (uint32_t)time(NULL);
    return(clonestr("{\"error\":\"iguana jsonstr expired\"}"));
}
开发者ID:botvs,项目名称:SuperNET,代码行数:29,代码来源:main.c

示例5: ini_mtx

ER
ini_mtx(ID mtxid)
{
	MTXCB	*p_mtxcb;
	TCB		*p_loctsk;
	bool_t	dspreq;
	ER		ercd;
    
	LOG_INI_MTX_ENTER(mtxid);
	CHECK_TSKCTX_UNL();
	CHECK_MTXID(mtxid);
	p_mtxcb = get_mtxcb(mtxid);

	t_lock_cpu();
	dspreq = init_wait_queue(&(p_mtxcb->wait_queue));
	p_loctsk = p_mtxcb->p_loctsk;
	if (p_loctsk != NULL) {
		queue_delete(&(p_mtxcb->mutex_queue));
		p_mtxcb->p_loctsk = NULL;
		if (MTX_CEILING(p_mtxcb)) {
			if (mutex_drop_priority(p_loctsk, p_mtxcb->p_mtxinib->ceilpri)) {
				dspreq = true;
			}
		}
	}
	if (dspreq) {
		dispatch();
	}
	ercd = E_OK;
	t_unlock_cpu();

  error_exit:
	LOG_INI_MTX_LEAVE(ercd);
	return(ercd);
}
开发者ID:duanlv,项目名称:asp-gr_peach_gcc-mbed,代码行数:35,代码来源:mutex.c

示例6: P

void P(struct semaphore* sig){

	if (!sig->INT)
		cli();

	sig->value--;
	if (sig->value < 0){
		queue_delete(current_pcb);
		if (sig->value == -1){
			current_pcb->pre_pcb = current_pcb;
			current_pcb->next_pcb = current_pcb;
			sig->waitlist = current_pcb;
		}
		else
			queue_insert(sig->waitlist, current_pcb);	/*wait*/
		proc_run--;
		if (sig->INT)
			pick_proc();
		else 
			yield();
	}

	if (!sig->INT)
		sti();
}
开发者ID:archeart,项目名称:MiniOS,代码行数:25,代码来源:procom.c

示例7: snd_seq_queue_client_leave

/* final stage notification -
 * remove cells for no longer exist client (for non-owned queue)
 * or delete this queue (for owned queue)
 */
void snd_seq_queue_client_leave(int client)
{
    int i;
    struct snd_seq_queue *q;

    /* delete own queues from queue list */
    for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
        if ((q = queue_list_remove(i, client)) != NULL)
            queue_delete(q);
    }

    /* remove cells from existing queues -
     * they are not owned by this client
     */
    for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
        if ((q = queueptr(i)) == NULL)
            continue;
        if (test_bit(client, q->clients_bitmap)) {
            snd_seq_prioq_leave(q->tickq, client, 0);
            snd_seq_prioq_leave(q->timeq, client, 0);
            snd_seq_queue_use(q->queue, client, 0);
        }
        queuefree(q);
    }
}
开发者ID:274914765,项目名称:C,代码行数:29,代码来源:seq_queue.c

示例8: iset_flg

SYSCALL ER
iset_flg(ID flgid, FLGPTN setptn)
{
    FLGCB	*flgcb;
    TCB	*tcb;
    WINFO_FLG *winfo;
    ER	ercd;

    LOG_ISET_FLG_ENTER(flgid, setptn);
    CHECK_INTCTX_UNL();
    CHECK_FLGID(flgid);
    flgcb = get_flgcb(flgid);

    i_lock_cpu();
    flgcb->flgptn |= setptn;
    if (!(queue_empty(&(flgcb->wait_queue)))) {
        tcb = (TCB *)(flgcb->wait_queue.next);
        winfo = (WINFO_FLG *)(tcb->winfo);
        if (eventflag_cond(flgcb, winfo->waiptn,
                           winfo->wfmode, &(winfo->flgptn))) {
            queue_delete(&(tcb->task_queue));
            if (wait_complete(tcb)) {
                reqflg = TRUE;
            }
        }
    }
    ercd = E_OK;
    i_unlock_cpu();

exit:
    LOG_ISET_FLG_LEAVE(ercd);
    return(ercd);
}
开发者ID:Han40,项目名称:spamOSEK,代码行数:33,代码来源:eventflag.c

示例9: V

void V(struct semaphore* sig){
	struct pcb* rel;


	if (!sig->INT)
		cli();

	sig->value++;
	/*
	printk("sig->value: %d\n", sig->value);
	*/

	if (sig->value <= 0){
		rel = sig->waitlist;
		sig->waitlist = rel->next_pcb;
		queue_delete(rel);

		queue_autoins(head->next_pcb, rel);	 /* wake up */
		if (sig->value == 0)
			sig->waitlist = NULL;
		proc_run++;
	}

	if (!sig->INT)
		sti();

}
开发者ID:archeart,项目名称:MiniOS,代码行数:27,代码来源:procom.c

示例10: ready_queue_delete

/* Removes the tack 'tcb' from the RDYQUE 'rq'.
 */
void
ready_queue_delete(RDYQUE *rq,TCB *tcb)
	{
	INT		i, priority;

	/* Remove the task 'tcb' from the associated FIFO (for that priority).
	   However, it that task is the only element at that priority then
	   the 'bitmap' field must be adjusted.
	*/
	priority = tcb->priority;
	queue_delete(&(tcb->tskque));
	if ( !queue_empty_p(&(rq->tskque[priority])) )
		return;
	bitmap_clear(rq, priority);
	if ( priority!=rq->top_priority )
		return;

	/* This section of the code deals with the case where the highest
	   priority task was removed and as a result, the 'top_priority'
	   field must be updated.
	*/
	for ( i=priority/BITMAPSZ;i<NUM_BITMAP;i++ )
		{
		if ( rq->bitmap[i] )
			{
			rq->top_priority = i * BITMAPSZ + _ffs(rq->bitmap[i]);
			return;
			}
		}
	rq->top_priority = NUM_PRI;
	}
开发者ID:tahamsaglam,项目名称:w0807,代码行数:33,代码来源:READY_Q.C

示例11: memdelete

void EditorAssetLibraryItemDownload::_close() {

	DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
	da->remove(download->get_download_file()); //clean up removed file
	memdelete(da);
	queue_delete();
}
开发者ID:MattUV,项目名称:godot,代码行数:7,代码来源:asset_library_editor_plugin.cpp

示例12: main

int main(void)
{
    user_tests();
    queue_tests();
    user_t user1 = user_new(1);
    user_t user2 = user_new(2);
    queue_t pQueue = queue_new();

    clock_t start;
    fflush(stdout);
    char c = 'f';
    while(c != '-')
    {
        start = clock();
        while(clock() - start < CLOCKS_PER_SEC/30)
        {
            user_checkComm(user1, user2, pQueue);
        }
            queue_print(pQueue);
            printf("\n");
            queue_countNull(pQueue);
            c = getch();
    }

    user_delete(user1);
    user_delete(user2);
    queue_delete(pQueue);

    return 0;
}
开发者ID:DariaDar,项目名称:Reposit,代码行数:30,代码来源:main.c

示例13: del_isr

ER
del_isr(ID isrid)
{
	ISRCB	*p_isrcb;
	ISRINIB	*p_isrinib;
	ER		ercd;

	LOG_DEL_ISR_ENTER(isrid);
	CHECK_TSKCTX_UNL();
	CHECK_ISRID(isrid);
	p_isrcb = get_isrcb(isrid);

	t_lock_cpu();
	if (p_isrcb->p_isrinib->isratr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (VIOLATE_ACPTN(p_isrcb->p_isrinib->acvct.acptn3)) {
		ercd = E_OACV;
	}
	else {
		queue_delete(&(p_isrcb->isr_queue));
		p_isrinib = (ISRINIB *)(p_isrcb->p_isrinib);
		p_isrinib->isratr = TA_NOEXS;
		queue_insert_prev(&free_isrcb, &(p_isrcb->isr_queue));
		ercd = E_OK;
	}
	t_unlock_cpu();

  error_exit:
	LOG_DEL_ISR_LEAVE(ercd);
	return(ercd);
}
开发者ID:PizzaFactory,项目名称:hrp2ev3,代码行数:32,代码来源:interrupt.c

示例14: check_cb

/* check:
 * Runs right after reactor calls poll(2).
 * Stop idle watcher, and send next alloc request, if available.
 */
static void check_cb (flux_reactor_t *r, flux_watcher_t *w,
                      int revents, void *arg)
{
    struct alloc_ctx *ctx = arg;
    struct job *job;

    flux_watcher_stop (ctx->idle);
    if (!ctx->ready)
        return;
    if (ctx->mode == SCHED_SINGLE && ctx->active_alloc_count > 0)
        return;
    if ((job = queue_first (ctx->inqueue))) {
        if (alloc_request (ctx, job) < 0) {
            flux_log_error (ctx->h, "alloc_request fatal error");
            flux_reactor_stop_error (flux_get_reactor (ctx->h));
            return;
        }
        queue_delete (ctx->inqueue, job, job->aux_queue_handle);
        job->aux_queue_handle = NULL;
        job->alloc_pending = 1;
        job->alloc_queued = 0;
        ctx->active_alloc_count++;
        if ((job->flags & FLUX_JOB_DEBUG))
            (void)event_job_post_pack (ctx->event_ctx, job,
                                       "debug.alloc-request", NULL);

    }
}
开发者ID:flux-framework,项目名称:flux-core,代码行数:32,代码来源:alloc.c

示例15: wobj_change_priority

void
wobj_change_priority(WOBJCB *wobjcb, TCB *tcb)
{
	if ((wobjcb->wobjinib->wobjatr & TA_TPRI) != 0) {
		queue_delete(&(tcb->task_queue));
		queue_insert_tpri(tcb, &(wobjcb->wait_queue));
	}
}
开发者ID:Ashatta,项目名称:tools,代码行数:8,代码来源:wait.c


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