From f6c9ebb65b9a1239638125b7c1f910f12c722b79 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 25 Sep 2007 17:39:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@20 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chsem.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/chsem.c') 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(); -- cgit v1.2.3