core: Fix/refactor function naming in core/incude/irq.h

This commit is contained in:
DipSwitch
2016-03-20 16:47:34 +01:00
parent 659faaffb1
commit 0bb4748a94
61 changed files with 342 additions and 342 deletions
+8 -8
View File
@@ -37,7 +37,7 @@ namespace riot {
condition_variable::~condition_variable() { m_queue.first = NULL; }
void condition_variable::notify_one() noexcept {
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
priority_queue_node_t* head = priority_queue_remove_head(&m_queue);
int other_prio = -1;
if (head != NULL) {
@@ -48,14 +48,14 @@ void condition_variable::notify_one() noexcept {
}
head->data = -1u;
}
restoreIRQ(old_state);
irq_restore(old_state);
if (other_prio >= 0) {
sched_switch(other_prio);
}
}
void condition_variable::notify_all() noexcept {
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
int other_prio = -1;
while (true) {
priority_queue_node_t* head = priority_queue_remove_head(&m_queue);
@@ -71,7 +71,7 @@ void condition_variable::notify_all() noexcept {
}
head->data = -1u;
}
restoreIRQ(old_state);
irq_restore(old_state);
if (other_prio >= 0) {
sched_switch(other_prio);
}
@@ -88,16 +88,16 @@ void condition_variable::wait(unique_lock<mutex>& lock) noexcept {
n.data = sched_active_pid;
n.next = NULL;
// the signaling thread may not hold the mutex, the queue is not thread safe
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
priority_queue_add(&m_queue, &n);
restoreIRQ(old_state);
irq_restore(old_state);
mutex_unlock_and_sleep(lock.mutex()->native_handle());
if (n.data != -1u) {
// on signaling n.data is set to -1u
// if it isn't set, then the wakeup is either spurious or a timer wakeup
old_state = disableIRQ();
old_state = irq_disable();
priority_queue_remove(&m_queue, &n);
restoreIRQ(old_state);
irq_restore(old_state);
}
mutex_lock(lock.mutex()->native_handle());
}