void TopLevelInterruptHandler(int dev) {
InterruptVector[dev](); // call appropriate handler
if (PreviousContext == ThreadContext) {
UnMaskInterrupts();
while(!Empty(WorkQueue)) {
Work = DeQueue(WorkQueue);
Work();
}
}
}
void NetworkInterruptHandler() {
// deal with interrupt
EnQueue(WorkQueue, MoreWork);
}
We'll come back to this, but for now look at signal handling which is simpler but has some of the same characteristics.