move the setting next pointer to NULL out off interrupt disable.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1450 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2011-06-04 13:30:43 +00:00
parent ae4fa4fcbe
commit 24c5c98240
1 changed files with 2 additions and 3 deletions

View File

@ -1713,6 +1713,8 @@ rt_err_t rt_mq_send (rt_mq_t mq, void* buffer, rt_size_t size)
/* enable interrupt */ /* enable interrupt */
rt_hw_interrupt_enable(temp); rt_hw_interrupt_enable(temp);
/* the msg is the new tailer of list, the next shall be NULL */
msg->next = RT_NULL;
/* copy buffer */ /* copy buffer */
rt_memcpy(msg + 1, buffer, size); rt_memcpy(msg + 1, buffer, size);
@ -1724,8 +1726,6 @@ rt_err_t rt_mq_send (rt_mq_t mq, void* buffer, rt_size_t size)
/* if the tail exists, */ /* if the tail exists, */
((struct rt_mq_message*)mq->msg_queue_tail)->next = msg; ((struct rt_mq_message*)mq->msg_queue_tail)->next = msg;
} }
/* the msg is the new tail of list, the next shall be NULL */
msg->next = RT_NULL;
/* set new tail */ /* set new tail */
mq->msg_queue_tail = msg; mq->msg_queue_tail = msg;
@ -1820,7 +1820,6 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, void* buffer, rt_size_t size)
rt_hw_interrupt_enable(temp); rt_hw_interrupt_enable(temp);
rt_schedule(); rt_schedule();
return RT_EOK; return RT_EOK;
} }