kernel: simplify procalarm()

This commit is contained in:
cinap_lenrek 2014-01-03 02:16:18 +01:00
parent 8ebe3f680e
commit 6929f0a986

View file

@ -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);