comparison src/proc.c @ 36:d4e5846ddb48

cbc_piperead
author mir3636
date Fri, 22 Feb 2019 22:15:33 +0900
parents 96af12a50fdb
children fb3e5a2f76c1
comparison
equal deleted inserted replaced
35:ad1d3b268e2d 36:d4e5846ddb48
526 p->state = RUNNABLE; 526 p->state = RUNNABLE;
527 } 527 }
528 } 528 }
529 } 529 }
530 530
531 __code cbc_wakeup1(void *chan)
532 {
533 struct proc *p;
534
535 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
536 if(p->state == SLEEPING && p->chan == chan) {
537 p->state = RUNNABLE;
538 }
539 }
540
541 release(&ptable.lock);
542 goto next();
543 }
544
545 __code cbc_wakeup(void *chan)
546 {
547 acquire(&ptable.lock);
548 cbc_wakeup1(chan);
549 }
550
531 // Wake up all processes sleeping on chan. 551 // Wake up all processes sleeping on chan.
532 void wakeup(void *chan) 552 void wakeup(void *chan)
533 { 553 {
534 acquire(&ptable.lock); 554 acquire(&ptable.lock);
535 wakeup1(chan); 555 wakeup1(chan);