X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Firq.c;h=9b87d69b25420b03798c027adad670524a1ff65f;hb=cfa8814ca45e8bae9b36713bc534ecb581834016;hp=23d19afac0ea76fb14abac4e87170822eb714807;hpb=022b3bd1d64ec490ddd0e8e3d72c0d1405504c31;p=bertos.git diff --git a/bertos/kern/irq.c b/bertos/kern/irq.c index 23d19afa..9b87d69b 100644 --- a/bertos/kern/irq.c +++ b/bertos/kern/irq.c @@ -57,29 +57,22 @@ void irq_entry(int signum) irq_handlers[signum](); #if CONFIG_KERN_PREEMPT - if (!CurrentProcess) - { - TRACEMSG("no runnable processes!"); - IRQ_ENABLE; - pause(); - } - else + ASSERT2(CurrentProcess, "no idle proc?"); + + if (old_process != CurrentProcess) { - if (old_process != CurrentProcess) - { - TRACEMSG("switching from %p:%s to %p:%s", - old_process, old_process ? old_process->monitor.name : "-", - CurrentProcess, CurrentProcess->monitor.name); - - if (old_process) - swapcontext(&old_process->context, &CurrentProcess->context); - else - setcontext(&CurrentProcess->context); - - // not reached - } - TRACEMSG("keeping %p:%s", CurrentProcess, CurrentProcess->monitor.name); + TRACEMSG("switching from %p:%s to %p:%s", + old_process, old_process ? old_process->monitor.name : "---", + CurrentProcess, CurrentProcess->monitor.name); + + if (old_process) + swapcontext(&old_process->context, &CurrentProcess->context); + else + setcontext(&CurrentProcess->context); + + // not reached } + //TRACEMSG("keeping %p:%s", CurrentProcess, CurrentProcess->monitor.name); #endif // CONFIG_KERN_PREEMPT } @@ -97,9 +90,7 @@ void irq_init(void) act.sa_flags = SA_RESTART; // | SA_SIGINFO; sigaction(SIGUSR1, &act, NULL); - #if !(ARCH & ARCH_QT) - sigaction(SIGALRM, &act, NULL); - #endif + sigaction(SIGALRM, &act, NULL); MOD_INIT(irq); }