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

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

commit 6a186b343296ca3910d2240c08f16a259052c907
Author: yukangzhi <[email protected]>
AuthorDate: Tue Dec 16 22:12:20 2025 +0800

    sched/init: check that the work queue threads are created.
    
    nx_workqueues() ignored the return values of work_start_highpri() and
    work_start_lowpri(), so a failure to create the HP/LP worker threads
    went unnoticed until some later work_queue() silently did nothing.
    
    Check the return values and assert on failure.
    
    Assisted-by: Kiro
    Signed-off-by: yukangzhi <[email protected]>
---
 sched/init/nx_bringup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sched/init/nx_bringup.c b/sched/init/nx_bringup.c
index 66e297e31b5..5a91fc9f1b6 100644
--- a/sched/init/nx_bringup.c
+++ b/sched/init/nx_bringup.c
@@ -194,6 +194,9 @@ static inline void nx_pgworker(void)
 #ifdef CONFIG_SCHED_WORKQUEUE
 static inline void nx_workqueues(void)
 {
+#if defined(CONFIG_SCHED_HPWORK) || defined(CONFIG_SCHED_LPWORK)
+  int ret;
+#endif
 #ifdef CONFIG_LIBC_USRWORK
   pid_t pid;
 #endif
@@ -203,7 +206,8 @@ static inline void nx_workqueues(void)
    * halves.
    */
 
-  work_start_highpri();
+  ret = work_start_highpri();
+  DEBUGASSERT(ret >= 0);
 
 #endif /* CONFIG_SCHED_HPWORK */
 
@@ -212,7 +216,8 @@ static inline void nx_workqueues(void)
    * continuation tasks
    */
 
-  work_start_lowpri();
+  ret = work_start_lowpri();
+  DEBUGASSERT(ret >= 0);
 
 #endif /* CONFIG_SCHED_LPWORK */
 

Reply via email to