From c303a8a06e68fb30c082a4f1a4fcc675ff0bd39e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 30 Nov 2007 09:00:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@121 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chqueues.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/chqueues.c') diff --git a/src/chqueues.c b/src/chqueues.c index 88eac2184..d0412598b 100644 --- a/src/chqueues.c +++ b/src/chqueues.c @@ -91,11 +91,10 @@ t_msg chIQGet(Queue *qp) { chSysLock(); - chSemWaitS(&qp->q_sem); - if (currp->p_rdymsg < RDY_OK) { + if (chSemWaitS(&qp->q_sem) < RDY_OK) { chSysUnlock(); - return currp->p_rdymsg; + return Q_RESET; } b = *qp->q_rdptr++; if (qp->q_rdptr >= qp->q_top) @@ -324,18 +323,17 @@ void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size, * Reads a byte from the receive queue, if the queue is empty or is in * transmission mode then the invoking thread is suspended. * @param qp pointer to a \p HalfDuplexQueue structure - * @return the byte value + * @return the byte value or \p Q_RESET if the queue was reset */ t_msg chHDQGetReceive(HalfDuplexQueue *qp) { BYTE8 b; chSysLock(); - chSemWaitS(&qp->hdq_isem); - if (currp->p_rdymsg < RDY_OK) { + if (chSemWaitS(&qp->hdq_isem) < RDY_OK) { chSysUnlock(); - return currp->p_rdymsg; + return Q_RESET; } /* * NOTE: The semaphore can be signaled only if the queue is in -- cgit v1.2.3