aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chsem.c')
-rw-r--r--src/chsem.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/chsem.c b/src/chsem.c
index 1eab23ea4..058187050 100644
--- a/src/chsem.c
+++ b/src/chsem.c
@@ -288,7 +288,7 @@ void chSemLowerPrioSignal(Semaphore *sp) {
chSysLock();
if (!--currp->p_rtcnt) {
- currp->p_prio = currp->p_bakprio;
+ currp->p_prio -= MEPRIO;
if (sp->s_cnt++ < 0)
chSchReadyI(dequeue(sp->s_queue.p_next));
chSchRescheduleI();
@@ -308,14 +308,11 @@ void chSemLowerPrioSignal(Semaphore *sp) {
* option is enabled in \p chconf.h.
*/
void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
- BOOL flag;
chSysLock();
if (sps->s_cnt++ < 0)
- chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE;
- else
- flag = FALSE;
+ chSchReadyI(dequeue(sps->s_queue.p_next));
if (--spw->s_cnt < 0) {
prioenq(currp, &spw->s_queue);
@@ -323,19 +320,13 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
if (!currp->p_rtcnt++)
currp->p_prio += MEPRIO;
-
- chSysUnlock();
- return;
- }
-
- if (!currp->p_rtcnt++) {
- currp->p_bakprio = currp->p_prio;
- currp->p_prio += MEPRIO;
- flag = TRUE;
}
+ else {
+ if (!currp->p_rtcnt++)
+ currp->p_prio += MEPRIO;
- if( flag)
chSchRescheduleI();
+ }
chSysUnlock();
}
@@ -349,21 +340,20 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
* option is enabled in \p chconf.h.
*/
void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) {
- BOOL flag = FALSE;
chSysLock();
if (!--currp->p_rtcnt)
- currp->p_prio = currp->p_bakprio, flag = TRUE;
+ currp->p_prio -= MEPRIO;
if (sps->s_cnt++ < 0)
- chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE;
+ chSchReadyI(dequeue(sps->s_queue.p_next));
if (--spw->s_cnt < 0) {
enqueue(currp, &spw->s_queue); // enqueue() because the spw is a normal sem.
chSchGoSleepI(PRWTSEM);
}
- else if (flag)
+ else
chSchRescheduleI();
chSysUnlock();