This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7e7b74fa9003e1c702dd73cb28714a51a8a6cc36
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 30 10:58:49 2026 +0100

    sched/mqueue: Use is_idle_task() in msgrcv() and msgsnd().
    
    msgrcv() and msgsnd() checked that the caller is not the idle task with
    DEBUGASSERT(NULL != rtcb->flink) before they block.  In an SMP build the
    running task of a CPU can be the only task in its assigned task list, so
    its flink is NULL, and the first msgrcv() or msgsnd() that waits stops
    the system with an assertion (msgrcv.c:129 on qemu-armv8a:nsh_smp with
    CONFIG_DEBUG_ASSERTIONS).
    
    Use is_idle_task(), as the POSIX message queues, the semaphores and the
    signals already do since commit 18266c10129.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 sched/mqueue/msgrcv.c | 2 +-
 sched/mqueue/msgsnd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sched/mqueue/msgrcv.c b/sched/mqueue/msgrcv.c
index 664daeab39d..b3044c806e7 100644
--- a/sched/mqueue/msgrcv.c
+++ b/sched/mqueue/msgrcv.c
@@ -126,7 +126,7 @@ static int msgrcv_wait(FAR struct msgq_s *msgq, FAR struct 
msgbuf_s **rcvmsg,
        * isn't going to end well.
        */
 
-      DEBUGASSERT(NULL != rtcb->flink);
+      DEBUGASSERT(!is_idle_task(rtcb));
 
       /* Remove the tcb task from the running list. */
 
diff --git a/sched/mqueue/msgsnd.c b/sched/mqueue/msgsnd.c
index 9f4edb8bdbc..3b769d672f4 100644
--- a/sched/mqueue/msgsnd.c
+++ b/sched/mqueue/msgsnd.c
@@ -92,7 +92,7 @@ static int msgsnd_wait(FAR struct msgq_s *msgq, int msgflg)
        * isn't going to end well.
        */
 
-      DEBUGASSERT(NULL != rtcb->flink);
+      DEBUGASSERT(!is_idle_task(rtcb));
 
       /* Remove the tcb task from the running list. */
 

Reply via email to