Call cantProceed() if taskwd task fails to start.

This commit is contained in:
Andrew Johnson
2008-06-09 18:10:47 +00:00
parent b88a1c685e
commit 5a0bed0407

View File

@@ -18,6 +18,7 @@
#include <stdlib.h>
#define epicsExportSharedSymbols
#include "cantProceed.h"
#include "dbDefs.h"
#include "epicsEvent.h"
#include "epicsExit.h"
@@ -84,7 +85,7 @@ static void freeNode(union twdNode *);
/* Initialization, lazy */
static void twdTask(void)
static void twdTask(void *arg)
{
struct tNode *pt;
struct mNode *pm;
@@ -134,8 +135,10 @@ static void twdShutdown(void *arg)
epicsEventWait(exitEvent);
}
static void twdInitPvt(void *arg)
static void twdInitOnce(void *arg)
{
epicsThreadId tid;
tLock = epicsMutexMustCreate();
ellInit(&tList);
@@ -149,16 +152,19 @@ static void twdInitPvt(void *arg)
loopEvent = epicsEventMustCreate(epicsEventEmpty);
exitEvent = epicsEventMustCreate(epicsEventEmpty);
epicsThreadCreate("taskwd", epicsThreadPriorityLow,
tid = epicsThreadCreate("taskwd", epicsThreadPriorityLow,
epicsThreadGetStackSize(epicsThreadStackSmall),
(EPICSTHREADFUNC)twdTask, 0);
twdTask, NULL);
if (tid == 0)
cantProceed("Failed to spawn task watchdog thread\n");
epicsAtExit(twdShutdown, NULL);
}
void taskwdInit()
{
static epicsThreadOnceId twdOnceFlag = EPICS_THREAD_ONCE_INIT;
epicsThreadOnce(&twdOnceFlag, twdInitPvt, NULL);
epicsThreadOnce(&twdOnceFlag, twdInitOnce, NULL);
}
@@ -379,6 +385,9 @@ epicsShareFunc void taskwdShow(int level)
epicsMutexUnlock(tLock);
}
/* Free list management */
static union twdNode *newNode(void)
{
union twdNode *pn;