From ec4178dd0ff7587b79a8c525aa88d467642ce629 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 2 Feb 2009 12:48:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@712 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chsem.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/chsem.c') diff --git a/src/chsem.c b/src/chsem.c index 3af4854f5..bc7e8f1b7 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -25,6 +25,13 @@ #include #ifdef CH_USE_SEMAPHORES + +#ifdef CH_USE_SEMAPHORES_PRIORITY +#define sem_insert(tp, qp) prio_insert(tp, qp) +#else +#define sem_insert(tp, qp) queue_insert(tp, qp) +#endif + /** * @brief Initializes a semaphore with the specified counter value. * @@ -110,7 +117,7 @@ msg_t chSemWait(Semaphore *sp) { msg_t chSemWaitS(Semaphore *sp) { if (--sp->s_cnt < 0) { - queue_insert(currp, &sp->s_queue); + sem_insert(currp, &sp->s_queue); currp->p_wtsemp = sp; chSchGoSleepS(PRWTSEM); return currp->p_rdymsg; @@ -157,7 +164,7 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) { msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) { if (--sp->s_cnt < 0) { - queue_insert(currp, &sp->s_queue); + sem_insert(currp, &sp->s_queue); currp->p_wtsemp = sp; return chSchGoSleepTimeoutS(PRWTSEM, time); } @@ -221,7 +228,7 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) { chSchReadyI(fifo_remove(&sps->s_queue))->p_rdymsg = RDY_OK; if (--spw->s_cnt < 0) { - queue_insert(currp, &spw->s_queue); + sem_insert(currp, &spw->s_queue); currp->p_wtsemp = spw; chSchGoSleepS(PRWTSEM); msg = currp->p_rdymsg; -- cgit v1.2.3