Skip to content

Commit

Permalink
Don't evaluate inISR() if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Dec 11, 2014
1 parent 370f926 commit 310ea35
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/sched.c
Expand Up @@ -150,17 +150,16 @@ void sched_set_status(tcb_t *process, unsigned int status)

void sched_switch(uint16_t other_prio)
{
int in_isr = inISR();
tcb_t *active_thread = (tcb_t *) sched_active_thread;
uint16_t current_prio = active_thread->priority;
int on_runqueue = (active_thread->status >= STATUS_ON_RUNQUEUE);

DEBUG("sched_switch: active pid=%" PRIkernel_pid" prio=%" PRIu16 " on_runqueue=%i "
", other_prio=%" PRIu16 " in_isr=%i\n",
active_thread->pid, current_prio, on_runqueue, other_prio, in_isr);
", other_prio=%" PRIu16 "\n",
active_thread->pid, current_prio, on_runqueue, other_prio);

if (!on_runqueue || (current_prio > other_prio)) {
if (in_isr) {
if (inISR()) {
DEBUG("sched_switch: setting sched_context_switch_request.\n");
sched_context_switch_request = 1;
}
Expand Down

0 comments on commit 310ea35

Please sign in to comment.