消息队列接收与紧急发送代码修改 #1

Merged
smileyk merged 1 commits from msg_que_modifications into master 2026-04-03 17:32:46 +08:00
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}