mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
* some more mutex related changes
This commit is contained in:
parent
21e6aaff24
commit
0441c5a4a4
@ -25,7 +25,7 @@ void sched_init();
|
||||
void sched_run();
|
||||
|
||||
void sched_set_status(tcb *process, unsigned int status);
|
||||
void sched_switch_if_higher(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);
|
||||
|
||||
volatile unsigned int sched_context_switch_request;
|
||||
|
||||
|
@ -68,7 +68,7 @@ void mutex_wait(struct mutex_t *mutex) {
|
||||
n.data = (unsigned int) active_thread;
|
||||
n.next = NULL;
|
||||
|
||||
DEBUG("%s: Adding node to mutex queue: prio: %u data: %u\n", active_thread->name, n.priority, n.data);
|
||||
DEBUG("%s: Adding node to mutex queue: prio: %u\n", active_thread->name, n.priority);
|
||||
|
||||
queue_priority_add(&(mutex->queue), &n);
|
||||
|
||||
@ -90,7 +90,7 @@ void mutex_unlock(struct mutex_t* mutex, int yield) {
|
||||
DEBUG("%s: waking up waiter %s.\n", process->name);
|
||||
sched_set_status(process, STATUS_PENDING);
|
||||
|
||||
sched_switch_if_higher(active_thread->priority, process->priority, inISR());
|
||||
sched_switch(active_thread->priority, process->priority, inISR());
|
||||
} else {
|
||||
mutex->val = 0;
|
||||
}
|
||||
|
@ -143,8 +143,9 @@ void sched_set_status(tcb *process, unsigned int status) {
|
||||
process->status = status;
|
||||
}
|
||||
|
||||
void sched_switch_if_higher(uint16_t current_prio, uint16_t other_prio, int in_isr) {
|
||||
if (current_prio < other_prio) {
|
||||
void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr) {
|
||||
DEBUG("%s: %i %i %i\n", active_thread->name, (int)current_prio, (int)other_prio, in_isr);
|
||||
if (current_prio <= other_prio) {
|
||||
if (in_isr) {
|
||||
sched_context_switch_request = 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user