Add epicsThreadResume to IOCSH.

This commit is contained in:
W. Eric Norum
2006-02-03 19:36:09 +00:00
parent ba9499c786
commit 4074b45a30
2 changed files with 46 additions and 0 deletions

View File

@@ -11,6 +11,9 @@
<h2 align="center">Changes since 3.14.8.2</h2>
<h4>iocsh</h4>
<p>Added epicsThreadResume command.</p>
<h4>libCom</h4>
<p>mallocMustSucceed and callocMustSucceed accept 0-byte requests. Note that these routines my return a NULL pointer in such cases.</p>

View File

@@ -55,9 +55,52 @@ static void epicsThreadSleepCallFunc(const iocshArgBuf *args)
epicsThreadSleep(args[0].dval);
}
/* epicsThreadResume */
static const iocshArg epicsThreadResumeArg0 = { "[thread ...]", iocshArgArgv};
static const iocshArg * const epicsThreadResumeArgs[1] = { &epicsThreadResumeArg0 };
static const iocshFuncDef epicsThreadResumeFuncDef = {"epicsThreadResume",1,epicsThreadResumeArgs};
static void epicsThreadResumeCallFunc(const iocshArgBuf *args)
{
int i;
const char *cp;
epicsThreadId tid;
unsigned long ltmp;
char nameBuf[64];
int argc = args[0].aval.ac;
char **argv = args[0].aval.av;
char *endp;
for (i = 1 ; i < argc ; i++) {
cp = argv[i];
ltmp = strtoul(cp, &endp, 0);
if (*endp) {
tid = epicsThreadGetId(cp);
if (!tid) {
printf("*** argument %d (%s) is not a valid thread name ***\n", i, cp);
continue;
}
}
else {
tid =(epicsThreadId)ltmp;
epicsThreadGetName(tid, nameBuf, sizeof nameBuf);
if (nameBuf[0] == '\0') {
printf("*** argument %d (%s) is not a valid thread id ***\n", i, cp);
continue;
}
}
if (!epicsThreadIsSuspended(tid)) {
printf("*** Thread %s is not suspended ***\n", cp);
continue;
}
epicsThreadResume(tid);
}
}
void epicsShareAPI osiRegister(void)
{
iocshRegister(&epicsThreadShowAllFuncDef,epicsThreadShowAllCallFunc);
iocshRegister(&epicsMutexShowAllFuncDef,epicsMutexShowAllCallFunc);
iocshRegister(&epicsThreadSleepFuncDef,epicsThreadSleepCallFunc);
iocshRegister(&epicsThreadResumeFuncDef,epicsThreadResumeCallFunc);
}