diff --git a/demos/ARM7-LPC214x-GCC/chcore.h b/demos/ARM7-LPC214x-GCC/chcore.h index 268cae39b..5217e30f6 100644 --- a/demos/ARM7-LPC214x-GCC/chcore.h +++ b/demos/ARM7-LPC214x-GCC/chcore.h @@ -101,6 +101,7 @@ extern void chSysUnlock(void); (INT_REQUIRED_STACK) + \ (n)) +/* It requires zero bytes, but better be safe.*/ #define IDLE_THREAD_STACK_SIZE 8 void _IdleThread(void *p) __attribute__((noreturn)); diff --git a/src/chmsg.c b/src/chmsg.c index 0f24b24aa..b70ebbcfe 100644 --- a/src/chmsg.c +++ b/src/chmsg.c @@ -37,9 +37,9 @@ t_msg chMsgSend(Thread *tp, t_msg msg) { chSysLock(); fifo_insert(currp, &tp->p_msgqueue); + currp->p_msg = msg; if (tp->p_state == PRWTMSG) chSchReadyI(tp); - currp->p_msg = msg; chSchGoSleepS(PRSNDMSG); msg = currp->p_rdymsg; @@ -184,7 +184,10 @@ void chMsgRelease(t_msg msg) { chSysLock(); -// if (!chMsgIsPendingI(currp) +#ifdef CH_USE_DEBUG + if (!chMsgIsPendingI(currp)) + chDbgPanic("chmsg.c, chMsgRelease()\r\n"); +#endif chSchWakeupS(fifo_remove(&currp->p_msgqueue), msg); chSysUnlock();