| plan 9 kernel history: overview | file list | diff list |
1992/0701/port/proc.c (diff list | history)
| 1992/0622/sys/src/9/port/proc.c:326,351 – 1992/0701/sys/src/9/port/proc.c:326,360 (short | long | prev | next) | ||
|
Take self out of talarm.list if checkalarm didn't. (BUG FIX).
Cleaner linked-list manipulation in tsleep.
rsc Mon Mar 20 17:30:39 2006 | ||
| 1992/0602 | tsleep(Rendez *r, int (*fn)(void*), void *arg, int ms) | |
| 1990/0227 | { | |
| 1992/0602 | ulong when; | |
| 1992/0701 | Proc *p, *f, **l; | |
| 1990/0227 | ||
| 1991/0727 | p = u->p; | |
| 1992/0602 | when = MS2TK(ms)+MACHP(0)->ticks; | |
| 1992/0701 | /* take out of list if checkalarm didn't */ if(p->trend) { l = &talarm.list; for(f = *l; f; f = f->tlink) { if(f == p) { *l = p->tlink; break; } l = &f->tlink; } } /* insert in increasing time order */ | |
| 1992/0602 | l = &talarm.list; | |
| 1992/0701 | for(f = *l; f; f = f->tlink) { if(f->twhen >= when) break; | |
| 1992/0602 | l = &f->tlink; | |
| 1991/0727 | } | |
| 1992/0602 | p->trend = r; p->twhen = when; | |
| 1992/0617 | p->tfn = fn; | |
| 1992/0602 |
| |
| 1992/0701 | p->tlink = *l; *l = p; | |
| 1992/0602 | unlock(&talarm); | |
| 1992/0617 | sleep(r, tfn, arg); | |