From 604008ff9411693813487924ba53036248633b77 Mon Sep 17 00:00:00 2001 From: Hanhui Date: Wed, 13 Jan 2016 11:27:43 +0800 Subject: [PATCH] Fixed msgQSend() called in ISR mode. --- target/src/msgQLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/src/msgQLib.c b/target/src/msgQLib.c index 013b0b9..21740d3 100644 --- a/target/src/msgQLib.c +++ b/target/src/msgQLib.c @@ -181,8 +181,16 @@ STATUS msgQSend (MSG_Q_ID msgQId, char *buffer, UINT nBytes, return (ERROR); } - ulError = API_SemaphoreBPend(msgQId->wrSync, vx2syMsgQTo(timeout)); + if (API_InterGetNesting()) { + errno = ERROR_MSGQUEUE_FULL; + return (ERROR); + + } else { + ulError = API_SemaphoreBPend(msgQId->wrSync, vx2syMsgQTo(timeout)); + } + if (ulError) { + errno = ERROR_MSGQUEUE_FULL; return (ERROR); } }