diff --git a/core/include/sched.h b/core/include/sched.h index c905573d22..8332a1a9be 100644 --- a/core/include/sched.h +++ b/core/include/sched.h @@ -55,9 +55,8 @@ void sched_set_status(tcb_t *process, unsigned int status); * * @param[in] current_prio The priority of the current thread * @param[in] other_prio The priority of the target thread - * @param[in] in_isr 1 if currently in interrupt context, 0 otherwise */ -void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr); +void sched_switch(uint16_t current_prio, uint16_t other_prio); /** * @brief Call context switching at task exit diff --git a/core/mutex.c b/core/mutex.c index ece0b0118b..664b864df4 100644 --- a/core/mutex.c +++ b/core/mutex.c @@ -108,7 +108,7 @@ void mutex_unlock(struct mutex_t *mutex) DEBUG("%s: waking up waiter.\n", process->name); sched_set_status(process, STATUS_PENDING); - sched_switch(active_thread->priority, process->priority, inISR()); + sched_switch(active_thread->priority, process->priority); } else { mutex->val = 0; diff --git a/core/sched.c b/core/sched.c index 90556603cb..1863d197e3 100644 --- a/core/sched.c +++ b/core/sched.c @@ -171,8 +171,10 @@ void sched_set_status(tcb_t *process, unsigned int status) process->status = status; } -void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr) +void sched_switch(uint16_t current_prio, uint16_t other_prio) { + int in_isr = inISR(); + DEBUG("%s: %i %i %i\n", active_thread->name, (int)current_prio, (int)other_prio, in_isr); if (current_prio >= other_prio) { diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c index 222e341167..f3fb22d807 100644 --- a/sys/posix/pthread/pthread.c +++ b/sys/posix/pthread/pthread.c @@ -152,7 +152,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta return -1; } - sched_switch(active_thread->priority, PRIORITY_MAIN, inISR()); + sched_switch(active_thread->priority, PRIORITY_MAIN); return 0; } diff --git a/sys/semaphore/semaphore.c b/sys/semaphore/semaphore.c index 7e155547a0..6276226e88 100644 --- a/sys/semaphore/semaphore.c +++ b/sys/semaphore/semaphore.c @@ -145,7 +145,7 @@ int sem_post(sem_t *sem) tcb_t *next_process = (tcb_t*) next->data; DEBUG("%s: waking up %s\n", active_thread->name, next_process->name); sched_set_status(next_process, STATUS_PENDING); - sched_switch(active_thread->priority, next_process->priority, inISR()); + sched_switch(active_thread->priority, next_process->priority); } restoreIRQ(old_state);