From 4b3e30ddacdd35855e092aad195668d1c0165476 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Tue, 7 Mar 2000 17:44:00 +0000 Subject: [PATCH] Make RTEMS version of threadShow work like POSIX version when passed a thread ID of 0 (print a header). --- src/libCom/osi/os/RTEMS/osdThread.c | 35 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/osdThread.c b/src/libCom/osi/os/RTEMS/osdThread.c index 5c8d8afaf..70e0e6660 100644 --- a/src/libCom/osi/os/RTEMS/osdThread.c +++ b/src/libCom/osi/os/RTEMS/osdThread.c @@ -478,29 +478,40 @@ threadShowHeader (void) printf ("+-----------+--------+---+-----------+--------+\n"); } +static void +threadShowInfo (struct taskVar *v, unsigned int level) +{ + printf ("%12.12s %8.8x", v->name, v->id); + showInternalTaskInfo (v->id); + printf ("\n"); +} + void threadShow (threadId id, unsigned int level) { struct taskVar *v; - int shown = 0; + if (!id) { + threadShowHeader (); + return; + } taskVarLock (); for (v = taskVarHead ; v != NULL ; v = v->forw) { - if ((id == 0) || ((rtems_id)id == v->id)) { - if (!shown) { - threadShowHeader (); - shown++; - } - printf ("%12.12s %8.8x", v->name, v->id); - showInternalTaskInfo (v->id); - printf ("\n"); + if ((rtems_id)id == v->id) { + threadShowInfo (v, level); + return; } } taskVarUnlock (); - if (id && !shown) - printf ("*** Thread %#x does not exist.\n", (unsigned int)id); + printf ("*** Thread %x does not exist.\n", (unsigned int)id); } void threadShowAll (unsigned int level) { - threadShow (0, level); + struct taskVar *v; + + threadShowHeader (); + taskVarLock (); + for (v = taskVarHead ; v != NULL ; v = v->forw) + threadShowInfo (v, level); + taskVarUnlock (); }