From b1db8a9f7fe3bc2cd48c52e7c2c50e0e118f8889 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 7 Jan 2008 14:06:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@166 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chmsg.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/chmsg.c') diff --git a/src/chmsg.c b/src/chmsg.c index 61546d7c1..20a59904e 100644 --- a/src/chmsg.c +++ b/src/chmsg.c @@ -36,7 +36,14 @@ t_msg chMsgSend(Thread *tp, t_msg msg) { chSysLock(); +#ifdef CH_USE_MESSAGES_PRIORITY + if (tp->p_flags & P_MSGBYPRIO) + prio_insert(currp, &tp->p_msgqueue); + else + fifo_insert(currp, &tp->p_msgqueue); +#else fifo_insert(currp, &tp->p_msgqueue); +#endif currp->p_msg = msg; if (tp->p_state == PRWTMSG) chSchReadyI(tp, RDY_OK); @@ -67,7 +74,14 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) { chSysLock(); chDbgAssert(tp->p_state != PRWTMSG, "chmsg.c, chMsgSendWithEvent()"); +#ifdef CH_USE_MESSAGES_PRIORITY + if (tp->p_flags & P_MSGBYPRIO) + prio_insert(currp, &tp->p_msgqueue); + else + fifo_insert(currp, &tp->p_msgqueue); +#else fifo_insert(currp, &tp->p_msgqueue); +#endif chEvtSendI(esp); currp->p_msg = msg; chSchGoSleepS(PRSNDMSG); @@ -107,7 +121,14 @@ t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time) { chSysLock(); chVTSetI(&vt, time, wakeup, currp); +#ifdef CH_USE_MESSAGES_PRIORITY + if (tp->p_flags & P_MSGBYPRIO) + prio_insert(currp, &tp->p_msgqueue); + else + fifo_insert(currp, &tp->p_msgqueue); +#else fifo_insert(currp, &tp->p_msgqueue); +#endif if (tp->p_state == PRWTMSG) chSchReadyI(tp, RDY_OK); currp->p_msg = msg; -- cgit v1.2.3