- Connections write timeouts were incorrectly handled in asynnetc. Fixed.

- Implemented the desired run/drive behaviour: drive waits for what it started
  run starts, and success waits for everything to finish. This required
  changes to a lot of files.
- Fixed a bug in remob which supressed required messages
This commit is contained in:
koennecke
2009-04-17 12:52:01 +00:00
parent 50b0a5c4a7
commit 99d2485d22
39 changed files with 422 additions and 200 deletions

View File

@ -15,6 +15,9 @@
Reworked to use copied connection objects instead of context pushes.
Mark Koennecke, January 2009
Modified to accomodate run levels
Mark Koennecke, April 2009
Copyright:
Labor fuer Neutronenstreuung
@ -121,6 +124,7 @@ typedef struct _DevEntry {
float fVal;
char *name;
SConnection *pCon;
int level;
} DevEntry, *pDevEntry;
/*------------------------------------------------------------------------*/
typedef struct {
@ -131,7 +135,7 @@ typedef struct {
} checkContext, *pCheckContext;
/*-------------------------------------------------------------------------*/
static pDevEntry CreateDevEntry(pObjectDescriptor pDes, SConnection * pCon,
void *pData, float fVal, char *name)
void *pData, float fVal, char *name, int level)
{
pDevEntry pNew = NULL;
@ -146,6 +150,8 @@ static pDevEntry CreateDevEntry(pObjectDescriptor pDes, SConnection * pCon,
pNew->name = strdup(name);
pNew->fVal = fVal;
pNew->pCon = SCCopyConnection(pCon);
pNew->pCon->runLevel = level;
pNew->level = level;
return pNew;
}
@ -275,7 +281,7 @@ void ExeInterest(pExeList self, pDevEntry pDev, char *text)
/*------------------------------------------------------------------------*/
int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
void *pData, SConnection * pCon, float fNew)
void *pData, SConnection * pCon, int level, float fNew)
{
pDevEntry pNew = NULL;
int iRet;
@ -319,7 +325,7 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
/* well create a new entry */
self->iStop = 0;
pNew = CreateDevEntry(pDes, pCon, pData, fNew, name);
pNew = CreateDevEntry(pDes, pCon, pData, fNew, name, level);
if (!pNew) {
SCWrite(pCon, "ERROR: memory exhausted in Device Executor ", eError);
return 0;
@ -380,7 +386,7 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
/*--------------------------------------------------------------------------*/
int StartMotor(pExeList self, SicsInterp * pSics, SConnection * pCon,
char *name, float fVal)
char *name, int level, float fVal)
{
pDummy pMot = NULL;
CommandList *pCom = NULL;
@ -415,12 +421,12 @@ int StartMotor(pExeList self, SicsInterp * pSics, SConnection * pCon,
return 0;
}
return StartDevice(self, name, pMot->pDescriptor, (void *) pMot, pCon,
fVal);
level, fVal);
}
/*---------------------------------------------------------------------------*/
int StartCounter(pExeList self, SicsInterp * pSics, SConnection * pCon,
char *name)
int level, char *name)
{
pCounter pCter = NULL;
CommandList *pCom = NULL;
@ -455,7 +461,7 @@ int StartCounter(pExeList self, SicsInterp * pSics, SConnection * pCon,
return 0;
}
return StartDevice(self, name, pCter->pDes, (void *) pCter,
pCon, pCter->pDriv->fPreset);
pCon, level, pCter->pDriv->fPreset);
}
/*-------------------------------------------------------------------------*/
@ -652,6 +658,27 @@ int CheckExeList(pExeList self)
iRet = LLDnodePtr2First(self->iList);
return testFinish(self);
}
/*---------------------------------------------------------------------------*/
int DevExecLevelRunning(pExeList self, int level)
{
int iRet;
pDevEntry pDev = NULL;
if(self->lTask < 0){
return 0;
}
iRet = LLDnodePtr2First(self->iList);
while (iRet != 0) {
LLDnodeDataTo(self->iList, &pDev);
if (pDev) {
if(pDev->level >= level){
return 1;
}
}
iRet = LLDnodePtr2Next(self->iList);
}
return 0;
}
/*---------------------------------------------------------------------------*/
int Wait4Success(pExeList self)
@ -667,7 +694,10 @@ int Wait4Success(pExeList self)
}
/* wait for Devexec task to finish */
TaskWait(self->pTask, self->lTask);
/*TaskWait(self->pTask, self->lTask); */
while(DevExecLevelRunning(self,RUNDRIVE)){
TaskYield(self->pTask);
}
#ifdef DEBUG
printf("Wait4Success finished\n");
#endif
@ -759,7 +789,7 @@ int StopExe(pExeList self, char *name)
}
iRet = LLDnodePtr2Next(self->iList);
}
SCWrite(self->pOwner, "ERROR: Full Stop called!!", eError);
SCWrite(self->pOwner, "ERROR: Full Stop called!!", eLogError);
if (SCGetInterrupt(self->pOwner) > eContinue) {
self->iStatus = DEVINT;
}
@ -826,7 +856,9 @@ int StopByData(pExeList self, void *data)
int StopExeWait(pExeList self)
{
StopExe(self, "all");
Wait4Success(self);
while(DevExecLevelRunning(self,RUNRUN)){
TaskYield(self->pTask);
}
return 1;
}
/*--------------------------------------------------------------------------*/
@ -1044,10 +1076,14 @@ int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
{
int iRet;
Status eOld;
pExeList self = (pExeList)pData;
eOld = GetStatus();
SetStatus(eRunning);
iRet = Wait4Success((pExeList) pData);
while(DevExecLevelRunning(self, RUNRUN)){
TaskYield(self->pTask);
}
iRet = self->iStatus;
if (iRet == DEVINT) {
if (SCGetInterrupt(pCon) == eAbortOperation) {
SCSetInterrupt(pCon, eContinue);