1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

simplified sched_switch

sched_switch can check ISR itself.
This commit is contained in:
Oleg Hahm 2014-02-15 18:49:49 +01:00
parent 24f5ec929c
commit 32f918abe8
5 changed files with 7 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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

View File

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