kernel: simplify procalarm()
This commit is contained in:
parent
8ebe3f680e
commit
6929f0a986
1 changed files with 8 additions and 17 deletions
|
@ -83,24 +83,15 @@ procalarm(ulong time)
|
|||
}
|
||||
l = &f->palarm;
|
||||
}
|
||||
|
||||
up->palarm = 0;
|
||||
if(alarms.head) {
|
||||
l = &alarms.head;
|
||||
for(f = *l; f; f = f->palarm) {
|
||||
time = f->alarm;
|
||||
if(time != 0 && (long)(time - when) >= 0) {
|
||||
up->palarm = f;
|
||||
*l = up;
|
||||
goto done;
|
||||
}
|
||||
l = &f->palarm;
|
||||
}
|
||||
*l = up;
|
||||
l = &alarms.head;
|
||||
for(f = *l; f; f = f->palarm) {
|
||||
time = f->alarm;
|
||||
if(time != 0 && (long)(time - when) >= 0)
|
||||
break;
|
||||
l = &f->palarm;
|
||||
}
|
||||
else
|
||||
alarms.head = up;
|
||||
done:
|
||||
up->palarm = f;
|
||||
*l = up;
|
||||
up->alarm = when;
|
||||
qunlock(&alarms);
|
||||
|
||||
|
|
Loading…
Reference in a new issue