[PATCH v1] cpuuse: Fix top command quikly exit bug

tianye at sugon.com tianye at sugon.com
Tue Dec 26 06:52:56 UTC 2023


From: Tian Ye <tianye at sugon.com>

---
 cpukit/libmisc/cpuuse/cpuusagetop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagetop.c b/cpukit/libmisc/cpuuse/cpuusagetop.c
index eed89ad211..7cdbfecf08 100644
--- a/cpukit/libmisc/cpuuse/cpuusagetop.c
+++ b/cpukit/libmisc/cpuuse/cpuusagetop.c
@@ -535,7 +535,9 @@ rtems_cpuusage_top_thread (rtems_task_argument arg)
 
   data->thread_active = false;
 
-  rtems_task_exit();
+  while(true) {
+    rtems_task_wake_after(1);
+  }
 }
 
 void rtems_cpu_usage_top_with_plugin(
@@ -605,6 +607,7 @@ void rtems_cpu_usage_top_with_plugin(
       while (loops && data.thread_active)
         rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (100000));
 
+      rtems_task_delete (id);
       rtems_printf (printer, "load monitoring stopped.\n");
       return;
     }
-- 
2.34.1



More information about the devel mailing list