From 24c5c982401f65f8ef8eecbb7ef94ef83042b32f Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Sat, 4 Jun 2011 13:30:43 +0000 Subject: [PATCH] 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 --- src/ipc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index f4d721792c..e012a54aa6 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -1713,6 +1713,8 @@ rt_err_t rt_mq_send (rt_mq_t mq, void* buffer, rt_size_t size) /* enable interrupt */ rt_hw_interrupt_enable(temp); + /* the msg is the new tailer of list, the next shall be NULL */ + msg->next = RT_NULL; /* copy buffer */ 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, */ ((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 */ 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_schedule(); - return RT_EOK; }