aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsem.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-02 12:48:17 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-02 12:48:17 +0000
commitec4178dd0ff7587b79a8c525aa88d467642ce629 (patch)
tree6db0317be3b6d5246786cfd222b0a2991f6b2d96 /src/chsem.c
parentd1ea164bdb96503020d315cce14471c3e0d87c36 (diff)
downloadChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.tar.gz
ChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.tar.bz2
ChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@712 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chsem.c')
-rw-r--r--src/chsem.c13
1 files changed, 10 insertions, 3 deletions
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 <ch.h>
#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;