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

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


The following commit(s) were added to refs/heads/master by this push:
     new 323c16a5f Wrong start and end values would make dead cycle. Exchange 
the values when start value is bigger than end value.
323c16a5f is described below

commit 323c16a5fbe53dffbbe6a83e79cd48e90ea4a59d
Author: huangkai8 <[email protected]>
AuthorDate: Wed Apr 19 16:01:43 2023 +0800

    Wrong start and end values would make dead cycle. Exchange the values when 
start value is bigger than end value.
---
 system/dumpstack/dumpstack.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/system/dumpstack/dumpstack.c b/system/dumpstack/dumpstack.c
index 94af6483a..d779f8084 100644
--- a/system/dumpstack/dumpstack.c
+++ b/system/dumpstack/dumpstack.c
@@ -44,6 +44,7 @@ int main(int argc, FAR char *argv[])
 {
   int spid = -1;
   int epid = -1;
+  int tmp = -1;
 
   if (argc == 2)
     {
@@ -60,6 +61,13 @@ int main(int argc, FAR char *argv[])
       spid = epid = gettid();
     }
 
+  if (spid > epid)
+    {
+      tmp = spid;
+      spid = epid;
+      epid = tmp;
+    }
+
   do
     {
       sched_dumpstack(spid);

Reply via email to