这篇教程C++ wakeup1函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wakeup1函数的典型用法代码示例。如果您正苦于以下问题:C++ wakeup1函数的具体用法?C++ wakeup1怎么用?C++ wakeup1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wakeup1函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++) { if(proc->ofile[fd]) { fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); iput(proc->cwd); end_op(); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->parent == proc && p->is_thread == 1) { p->killed = 1; if(p->state == SLEEPING) { p->state = RUNNABLE; } } } for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->parent == proc) { if (p->state == ZOMBIE) { p->killed = 1; } join(p->pid); } } for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->parent == proc) { p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:qsheridan,项目名称:cosc301-proj04,代码行数:63,
示例2: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->pid == proc->pid && p->state != ZOMBIE){ //undead thread p->state = ZOMBIE; if(p->is_thread){//it is a thread if(p->parent->num_of_thread_child){ p->parent->num_of_thread_child--; } //no more childran if(!p->parent->num_of_thread_child){ wakeup1(p->parent->parent); } } else{//it is a proccees p->num_of_thread_child--; if(!p->num_of_thread_child){ wakeup1(p->parent); } } } else if(p->parent == proc && p->is_thread !=1){// a proccess child p->parent = initproc; if(p->state == ZOMBIE){ wakeup1(initproc); } } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:yonatana,项目名称:OS,代码行数:62,
示例3: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } #ifndef SELECTION_NONE #ifdef VERBOSE_PRINT_TRUE char* state; if(proc->state >= 0 && proc->state < NELEM(states) && states[proc->state]) state = states[proc->state]; else state = "???"; print_proc_data(proc, state); cprintf("/n"); #endif free_proc_pgmd(proc,1); //remove swap file and pages metadata #endif begin_op(); iput(proc->cwd); end_op(); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:reutz19,项目名称:xv6_ass3,代码行数:57,
示例4: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd] && proc->thread == 0){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); iput(proc->cwd); end_op(); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->thread == 1 && p->parent == proc){ p->killed = 1; if(p->state == SLEEPING) // Wake process from sleep if necessary p->state = RUNNABLE; release(&ptable.lock); join(p->pid); acquire(&ptable.lock); p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } else if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:rgavs,项目名称:cosc301-proj04,代码行数:54,
示例5: texit voidtexit(void){ // struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. // for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ // if(p->parent == proc){ // p->parent = initproc; // if(p->state == ZOMBIE) // wakeup1(initproc); // } // } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:aesgu001,项目名称:xv6-lab2,代码行数:35,
示例6: thread_exitvoidthread_exit(void* ret_val){ proc->ret_val=ret_val; if(is_main_thread(proc)) { // check if last running thread if(proc->tcount <= 1) { exit(); } else { // Wait for children to exit acquire(&ptable.lock); sleep(proc, &ptable.lock); release(&ptable.lock); exit(); } } // Normal thread exit acquire(&ptable.lock); //iput(proc->cwd); proc->parent->tcount--; proc->cwd = 0; // Parent might be sleeping in wait(). wakeup1(proc->parent); // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("thread zombie exit");}
开发者ID:RonBarabash,项目名称:OS132-Ass2,代码行数:32,
示例7: wakeup// Wake up all processes sleeping on chan.voidwakeup(void *chan){ acquire(&proc_table_lock); wakeup1(chan); release(&proc_table_lock);}
开发者ID:aaronb,项目名称:CS637,代码行数:8,
示例8: wakeup// Wake up all processes sleeping on chan.voidwakeup(void *chan){ acquire(&ptable.lock); wakeup1(chan); release(&ptable.lock);}
开发者ID:haa777,项目名称:332Assignment3,代码行数:8,
示例9: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting");// cprintf("pid: %d is exiting/n",proc->pid); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } // part 2 int j; for(j=0 ; j < 200 ; j++) unlockInodesTable[proc->pid][j] = 0; iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:B-Rich,项目名称:OperatingSystems,代码行数:49,
示例10: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; //**** remove--this may be unneccessary //cprintf("remove in exit/n"); removefromq(proc); //**** sched(); panic("zombie exit");}
开发者ID:jayakumark,项目名称:advanced_os_class,代码行数:48,
示例11: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; cprintf("Exiting process. System free pages is %d, replacement count is %d/n",kfreepagecount(),replacementcount()); if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); iput(proc->cwd); end_op(); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:zhengq0528,项目名称:CS426pizzadelivery,代码行数:46,
示例12: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *curproc = myproc(); struct proc *p; int fd; if(curproc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd]){ fileclose(curproc->ofile[fd]); curproc->ofile[fd] = 0; } } begin_op(); iput(curproc->cwd); end_op(); curproc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == curproc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. curproc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:buf1024,项目名称:xv6-public,代码行数:45,
示例13: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; int i; for(i = 0; i < 22; i++) proc->count[i]=0; // set counts to 0s after termination if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:XiaopeiZhang,项目名称:CS450,代码行数:45,
示例14: twakeupvoid twakeup(int tid){ struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state == SLEEPING && p->pid == tid && p->isthread == 1){ wakeup1(p); } } release(&ptable.lock);}
开发者ID:aesgu001,项目名称:xv6-lab2,代码行数:11,
示例15: exit// Exit the current process. Does not return.// Exited processes remain in the zombie state// until their parent calls wait() to find out they exited.voidexit(void){ struct proc *p; int fd; if(cp == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(cp->ofile[fd]){ fileclose(cp->ofile[fd]); cp->ofile[fd] = 0; } } iput(cp->cwd); cp->cwd = 0; acquire(&proc_table_lock); // Parent might be sleeping in wait(). wakeup1(cp->parent); // Pass abandoned children to init. for(p = proc; p < &proc[NPROC]; p++){ if(p->parent == cp){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. cp->killed = 0; setstate(cp, ZOMBIE); sched(); panic("zombie exit");}
开发者ID:aaronb,项目名称:CS637,代码行数:43,
示例16: cv_wakevoid cv_wake(int pid){ struct proc* p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->pid == pid) { wakeup1(p); break; } } release(&ptable.lock);}
开发者ID:Aarskin,项目名称:CS537,代码行数:17,
示例17: binary_semaphore_upintbinary_semaphore_up(int binary_semaphore_ID){ acquire(&sem_table.sem_locks[binary_semaphore_ID]); struct binary_semaphore* sem = &sem_table.binary_semaphore[binary_semaphore_ID]; if(sem->initialize){ struct proc *p; struct proc* next = 0; //looking for whom to wakeup who are sleeping and next acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p != proc && p->wait_for_sem == binary_semaphore_ID){ p->sem_queue_pos--; if(p->sem_queue_pos == 0) next = p; } } if(sem->waiting>0){ sem->waiting--; } sem->value = 1;//sem is available //wake up the next thread if(next && next->state == SLEEPING) next->state = RUNNABLE; release(&ptable.lock); release(&sem_table.sem_locks[binary_semaphore_ID]);//realsing the sem wakeup1(sem); return 0; } else{ release(&sem_table.sem_locks[binary_semaphore_ID]);//realsing the sem cprintf("we had problem at binary_semaphore_up: the semaphore wasn't initialize/n"); return -1; }}
开发者ID:yonatana,项目名称:OS,代码行数:40,
示例18: thread_exitvoid thread_exit(void * ret_val){ acquire(&ptable.lock); if(proc->is_thread){//not the main procces if(proc->parent->num_of_thread_child==1){//the main thread already thread_exit and also all other thread proc->parent->num_of_thread_child--; release(&ptable.lock); exit(); } //this is not the last thread by any mean proc->ret_val = ret_val; // not main thread and not the last one proc->parent->num_of_thread_child--; proc->state = ZOMBIE; if(proc->thread_joined){ wakeup1(proc); } sched(); release(&ptable.lock); } else if (proc->num_of_thread_child == 1){//this is the main thread and it is the last thread proc->num_of_thread_child--; release(&ptable.lock); exit(); } else{//this is the main thread but other thread are alive proc->num_of_thread_child--; proc->state = ZOMBIE; sched(); release(&ptable.lock); }}
开发者ID:yonatana,项目名称:OS,代码行数:37,
示例19: kthread_exitvoid kthread_exit(){ struct proc *p; int threadsCounter=0; acquire(&ptable.lock); if(proc == initproc) panic("init exiting"); int i=0; for(;i<64;i++) { if(proc->sleepingThreads[i]!=0) wakeup1(proc->sleepingThreads[i]); } for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->pid==proc->pid && p->state!=ZOMBIE && p->state!=UNUSED) { threadsCounter++; } } if(threadsCounter==1) { for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == ZOMBIE && p->pid ==proc->pid && proc->threadId != p->threadId){ kfree(p->kstack); p->kstack = 0; p->state = UNUSED; p->pid = 0; p->parent = 0; p->name[0] = 0; p->killed = 0; } release(&ptable.lock); New_exit(); return ; } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit"); }
开发者ID:zvikadori,项目名称:assignment2,代码行数:67,
示例20: exit// TODO(byan23): Set inuse[] to 0?// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ //cprintf("exit pid: %d./n", proc->pid); struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc){ p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; int slot_no; for (slot_no = 0; slot_no < NPROC; ++slot_no) { if (&ptable.proc[slot_no] == proc) break; } //cprintf("found at slot: %d/n", slot_no); int pri = proc_stat.priority[slot_no]; switch(pri) { case 0: remove_from_queue(&q0_head, &q0_tail, proc); break; case 1: remove_from_queue(&q1_head, &q1_tail, proc); break; case 2: remove_from_queue(&q2_head, &q2_tail, proc); break; case 3: remove_from_queue(&q3_head, &q3_tail, proc); break; default: cprintf("Wrong priority queue while exiting./n"); } proc_stat.inuse[slot_no] = 0; sched(); panic("zombie exit");}
开发者ID:byan23,项目名称:OprSys,代码行数:68,
示例21: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); if(proc->isThread == 0) { acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { //should only kill p if child of this proc and is a thread if(p->parent == proc && p->isThread == 1) { release(&ptable.lock); kill(p->pid); join(p->pid); acquire(&ptable.lock); } } release(&ptable.lock); } // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc) { if(p->isThread == 1) { release(&ptable.lock); kill(p->pid); join(p->pid); acquire(&ptable.lock); } else { p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:giang12,项目名称:Introduction-to-Operating-Systems,代码行数:68,
示例22: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void) { struct proc *p; int fd; // debug only struct proc* test = proc; if(test/*proc*/ == initproc) panic("init exiting"); acquire(&ptable.lock); // Close all open files. OG process only if(!proc->thread) { for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } } iput(proc->cwd); // decrement ref count if(!proc->thread) // only og process can wipe this out proc->cwd = 0; // Pass abandoned children to init, kill and join if thread for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->parent == proc) { if(p->thread) { // kill p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) p->state = RUNNABLE; join_logic(p->pid); } else { p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } } } // Parent might be sleeping in wait()/join(). wakeup1(proc->parent); // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:Aarskin,项目名称:CS537,代码行数:65,
示例23: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; int rmBrothers=0; if(!is_main_thread(proc)) { // Kill main thread proc->parent->killed=1; if(proc->parent->state==SLEEPING) proc->parent->state=RUNNABLE; //clear_thread(proc); rmBrothers=1; //return; } if(proc == initproc) panic("init exiting"); cprintf("#"); //release(&ptable.lock); if(!holding(&ptable.lock)) { cprintf("[ex%d]", proc->pid); acquire(&ptable.lock); } cprintf("%"); // Pass abandoned proc children to init & // kill all threads beneath (children who are not procs) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) { if(p->parent == proc) { if(is_main_thread(p) && rmBrothers==0) { p->parent = initproc; if(p->state == ZOMBIE) wakeup1(initproc); } else { clear_thread(p); } } } if(rmBrothers) goto end; // Close all open files. for(fd = 0; fd < NOFILE; fd++) { if(proc->ofile[fd]) { fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0;end: // Parent might be sleeping in wait(). wakeup1(proc->parent); // Jump into the scheduler, never to return. proc->state = ZOMBIE; sched(); panic("zombie exit");}
开发者ID:RonBarabash,项目名称:OS132-Ass2,代码行数:68,
示例24: exit// Exit the current process. Does not return.// An exited process remains in the zombie state// until its parent calls wait() to find out it exited.voidexit(void){ struct proc *p; int fd; if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(proc->ofile[fd]){ fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } iput(proc->cwd); proc->cwd = 0; acquire(&ptable.lock); //cprintf("Lock acquired in exit/n"); // Parent might be sleeping in wait(). // //wakeup1(proc->parent); //cprintf("Wakeup the parent/n"); //acquire(&ptable.lock); // Pass abandoned children to init. //if(proc->isThread==0) if(proc->isThread==0) { for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc && p->isThread==1) { /* cprintf("parent will kill children/n"); release(&ptable.lock); cprintf("Lock released in exit/n"); kill(p->pid); acquire(&ptable.lock); cprintf("Thread killed in exit/n"); join(p->pid); cprintf("Wait over for killed thread in exit/n"); acquire(&ptable.lock); cprintf("Lock acquired in exit for loop/n"); */ p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) p->state = RUNNABLE; while(p->state!=ZOMBIE){ sleep(proc,&ptable.lock); } //cprintf("Calling join/n"); kfree(p->kstack); p->kstack = 0; // freevm(p->pgdir); p->state = UNUSED; p->pid = 0; p->parent = 0; p->name[0] = 0; p->killed = 0; /*release(&ptable.lock); join(p->pid); acquire(&ptable.lock); */ continue; } } } wakeup1(proc->parent); if(proc->isThread==0) { for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == proc && p->isThread==0){ cprintf("Dealing with children process/n"); p->parent = initproc; if(p->state == ZOMBIE) { wakeup1(initproc); } } } } // Jump into the scheduler, never to return. proc->state = ZOMBIE;// cprintf("Calling schedule/n"); sched(); //release(&ptable.lock); //cprintf("LOck released finally"); panic("zombie exit");//.........这里部分代码省略.........
开发者ID:rasiga,项目名称:OS-projects,代码行数:101,
注:本文中的wakeup1函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wakeup_one函数代码示例 C++ wakeup函数代码示例 |