forked from xuos/xiuos
消息队列接收与紧急发送代码修改 #1
|
|
@ -180,7 +180,7 @@ static x_err_t _MsgQueueUrgentSend(struct MsgQueue *mq, const void *buffer, x_si
|
|||
if (mq->index < 0)
|
||||
mq->index += mq->max_msgs;
|
||||
|
||||
msg = mq->msg_buf + ( ( mq->index + mq->num_msgs ) % mq->max_msgs ) * mq->each_len ;
|
||||
msg = mq->msg_buf + (mq->index % mq->max_msgs) * mq->each_len;
|
||||
memcpy(msg , buffer, size);
|
||||
mq->num_msgs ++;
|
||||
if (!IsDoubleLinkListEmpty(&mq->send_pend_list)) {
|
||||
|
|
@ -214,7 +214,7 @@ static x_err_t _MsgQueueRecv(struct MsgQueue* mq,
|
|||
timeout = CalculateTickFromTimeMs(msec);
|
||||
|
||||
lock = CriticalAreaLock();
|
||||
if (mq->index == 0 && timeout == 0) {
|
||||
if (timeout == 0 && mq->num_msgs <= 0) {
|
||||
CriticalAreaUnLock(lock);
|
||||
return -ETIMEOUT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue