libCom/osi: Streamline epicsThreadShowInfo functions between implementations

- epicsThreadShowInfo: private function to print headers or task line,
  not in header file, using internal pointer type
This commit is contained in:
Ralph Lange
2012-07-03 11:16:09 +02:00
parent 7c27c7c56d
commit 0e6a01d56a
7 changed files with 20 additions and 24 deletions

View File

@@ -39,8 +39,6 @@ typedef struct epicsThreadOSD {
epicsShareFunc pthread_t epicsShareAPI epicsThreadGetPosixThreadId(epicsThreadId id);
epicsShareFunc void epicsShowThreadInfo(epicsThreadOSD *pthreadInfo, unsigned int level);
#ifdef __cplusplus
}
#endif

View File

@@ -27,7 +27,7 @@
#include "epicsEvent.h"
#include "epicsThread.h"
void epicsShowThreadInfo(epicsThreadOSD *pthreadInfo, unsigned int level)
void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level)
{
if(!pthreadInfo) {
fprintf(epicsGetStdout()," NAME EPICS ID "

View File

@@ -642,20 +642,18 @@ showInternalTaskInfo (rtems_id tid)
#endif
}
static void
epicsThreadShowHeader (void)
{
fprintf(epicsGetStdout()," PRIORITY\n");
fprintf(epicsGetStdout()," ID EPICS RTEMS STATE WAIT NAME\n");
fprintf(epicsGetStdout(),"+--------+-----------+--------+--------+---------------------+\n");
}
static void
epicsThreadShowInfo (struct taskVar *v, unsigned int level)
{
if (!v) {
fprintf(epicsGetStdout()," PRIORITY\n");
fprintf(epicsGetStdout()," ID EPICS RTEMS STATE WAIT NAME\n");
fprintf(epicsGetStdout(),"+--------+-----------+--------+--------+---------------------+\n");
} else {
fprintf(epicsGetStdout(),"%9.8x", (int)v->id);
showInternalTaskInfo (v->id);
fprintf(epicsGetStdout()," %s\n", v->name);
}
}
void epicsThreadShow (epicsThreadId id, unsigned int level)
@@ -663,7 +661,7 @@ void epicsThreadShow (epicsThreadId id, unsigned int level)
struct taskVar *v;
if (!id) {
epicsThreadShowHeader ();
epicsThreadShowInfo (NULL, level);
return;
}
taskVarLock ();

View File

@@ -951,9 +951,9 @@ static const char * epics_GetThreadPriorityAsString ( HANDLE thr )
}
/*
* epicsThreadShowPrivate ()
* epicsThreadShowInfo ()
*/
static void epicsThreadShowPrivate ( epicsThreadId id, unsigned level )
static void epicsThreadShowInfo ( epicsThreadId id, unsigned level )
{
win32ThreadParam * pParm = ( win32ThreadParam * ) id;
@@ -1014,10 +1014,10 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll ( unsigned level )
EnterCriticalSection ( & pGbl->mutex );
epicsThreadShowPrivate ( 0, level );
epicsThreadShowInfo ( 0, level );
for ( pParm = ( win32ThreadParam * ) ellFirst ( & pGbl->threadList );
pParm; pParm = ( win32ThreadParam * ) ellNext ( & pParm->node ) ) {
epicsThreadShowPrivate ( ( epicsThreadId ) pParm, level );
epicsThreadShowInfo ( ( epicsThreadId ) pParm, level );
}
LeaveCriticalSection ( & pGbl->mutex );
@@ -1028,8 +1028,8 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll ( unsigned level )
*/
epicsShareFunc void epicsShareAPI epicsThreadShow ( epicsThreadId id, unsigned level )
{
epicsThreadShowPrivate ( 0, level );
epicsThreadShowPrivate ( id, level );
epicsThreadShowInfo ( 0, level );
epicsThreadShowInfo ( id, level );
}
/*

View File

@@ -35,6 +35,8 @@
#include "epicsAssert.h"
#include "epicsExit.h"
epicsShareFunc void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level);
static int mutexLock(pthread_mutex_t *id)
{
int status;
@@ -767,7 +769,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level)
return;
pthreadInfo=(epicsThreadOSD *)ellFirst(&pthreadList);
while(pthreadInfo) {
epicsShowThreadInfo(pthreadInfo,level);
epicsThreadShowInfo(pthreadInfo,level);
pthreadInfo=(epicsThreadOSD *)ellNext(&pthreadInfo->node);
}
status = pthread_mutex_unlock(&listLock);
@@ -782,7 +784,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShow(epicsThreadId showThread, unsi
epicsThreadInit();
if(!showThread) {
epicsShowThreadInfo(0,level);
epicsThreadShowInfo(0,level);
return;
}
status = mutexLock(&listLock);
@@ -794,7 +796,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShow(epicsThreadId showThread, unsi
if (((epicsThreadId)pthreadInfo == showThread)
|| ((epicsThreadId)pthreadInfo->tid == showThread)) {
found = 1;
epicsShowThreadInfo(pthreadInfo,level);
epicsThreadShowInfo(pthreadInfo,level);
}
pthreadInfo=(epicsThreadOSD *)ellNext(&pthreadInfo->node);
}

View File

@@ -38,8 +38,6 @@ typedef struct epicsThreadOSD {
epicsShareFunc pthread_t epicsShareAPI epicsThreadGetPosixThreadId(epicsThreadId id);
epicsShareFunc void epicsShowThreadInfo(epicsThreadOSD *pthreadInfo, unsigned int level);
#ifdef __cplusplus
}
#endif

View File

@@ -17,7 +17,7 @@
#include "epicsEvent.h"
#include "epicsThread.h"
void epicsShowThreadInfo(epicsThreadOSD *pthreadInfo, unsigned int level)
void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level)
{
if(!pthreadInfo) {
fprintf(epicsGetStdout()," NAME EPICS ID "