From cd6ca24f88eb167486189eae7d742293203d60e5 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 4 Jan 2021 22:34:50 +0800 Subject: [PATCH] update --- src/ipc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index d8b9327795..11b7e266f9 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -1534,7 +1534,6 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, if (mb->entry == mb->size && timeout == 0) { rt_hw_interrupt_enable(temp); - return -RT_EFULL; } @@ -1678,8 +1677,14 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value) /* disable interrupt */ temp = rt_hw_interrupt_disable(); + if (mb->entry == mb->size) + { + rt_hw_interrupt_enable(temp); + return -RT_EFULL; + } + /* rewind to the previous position */ - if(mb->out_offset > 0) + if (mb->out_offset > 0) { mb->out_offset --; } @@ -1691,7 +1696,7 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value) /* set ptr */ mb->msg_pool[mb->out_offset] = value; - if(mb->entry < RT_MB_ENTRY_MAX) + if (mb->entry < RT_MB_ENTRY_MAX) { /* increase message entry */ mb->entry ++;