本文整理汇总了C++中queue_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ queue_delete函数的具体用法?C++ queue_delete怎么用?C++ queue_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了queue_delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: handle_usb
/* Return USB_HANDLED if session took place else return USB_EXTRACTED */
static int handle_usb(int connect_timeout)
{
static struct event_queue q SHAREDBSS_ATTR;
struct queue_event ev;
int usb = USB_EXTRACTED;
long end_tick = 0;
if (!usb_plugged())
return USB_EXTRACTED;
queue_init(&q, true);
usb_init();
usb_start_monitoring();
printf("USB: Connecting");
if (connect_timeout != TIMEOUT_BLOCK)
end_tick = current_tick + connect_timeout;
while (1)
{
/* Sleep no longer than 1/2s */
queue_wait_w_tmo(&q, &ev, HZ/2);
if (ev.id == SYS_USB_CONNECTED)
{
/* Switch to verbose mode if not in it so that the status updates
* are shown */
verbose = true;
/* Got the message - wait for disconnect */
printf("Bootloader USB mode");
usb = USB_HANDLED;
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&q);
break;
}
if (connect_timeout != TIMEOUT_BLOCK &&
TIME_AFTER(current_tick, end_tick))
{
/* Timed out waiting for the connect - will happen when connected
* to a charger instead of a host port and the charging pin is
* the same as the USB pin */
printf("USB: Timed out");
break;
}
if (!usb_plugged())
break; /* Cable pulled */
}
usb_close();
queue_delete(&q);
return usb;
}
开发者ID:albb0920,项目名称:rockbox,代码行数:58,代码来源:main-pp.c
示例17: alloc_dequeue_alloc_request
void alloc_dequeue_alloc_request (struct alloc_ctx *ctx, struct job *job)
{
if (job->alloc_queued) {
queue_delete (ctx->inqueue, job, job->aux_queue_handle);
job->aux_queue_handle = NULL;
job->alloc_queued = 0;
ctx->active_alloc_count--;
}
}
开发者ID:flux-framework,项目名称:flux-core,代码行数:9,代码来源:alloc.c
示例18: wait_cancel
void
wait_cancel(TCB *tcb)
{
if (tcb->winfo->tmevtb != NULL) {
tmevtb_dequeue(tcb->winfo->tmevtb);
}
if ((tcb->tstat & TS_WAIT_WOBJ) != 0) {
queue_delete(&(tcb->task_queue));
}
}
开发者ID:Ashatta,项目名称:tools,代码行数:10,代码来源:wait.c
示例19: wait_dequeue_wobj
void
wait_dequeue_wobj(TCB *p_tcb)
{
if (TSTAT_WAIT_WOBJ(p_tcb->tstat)) {
queue_delete(&(p_tcb->task_queue));
if (TSTAT_WAIT_SMBF(p_tcb->tstat)) {
(*mbfhook_dequeue_wobj)(p_tcb);
}
}
}
开发者ID:ev3rt-git,项目名称:ev3rt-hrp3,代码行数:10,代码来源:wait.c
示例20: snd_seq_queues_delete
/* delete all existing queues */
void __exit snd_seq_queues_delete(void)
{
int i;
/* clear list */
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if (queue_list[i])
queue_delete(queue_list[i]);
}
}
开发者ID:274914765,项目名称:C,代码行数:11,代码来源:seq_queue.c
注:本文中的queue_delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论