SICS-555: ANSTO hmcontrol now releases locks on the counters after pausing.
This commit is contained in:
committed by
Ferdi Franceschini
parent
a00ca3872f
commit
ed95f3aaaf
@@ -22,6 +22,33 @@
|
|||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
extern int ANSTO_HTTP_PAUSE;
|
extern int ANSTO_HTTP_PAUSE;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void *slaveData[MAXSLAVE];
|
||||||
|
pICountable slaves[MAXSLAVE];
|
||||||
|
char *transferScript;
|
||||||
|
int nSlaves;
|
||||||
|
} MultiCounter, *pMultiCounter;
|
||||||
|
|
||||||
|
/* Release locks on the multicounter and its slaves */
|
||||||
|
static int releaseMCntrLocks(void *pData) {
|
||||||
|
int i, retVal = OKOK;
|
||||||
|
pCounter pCount = NULL;
|
||||||
|
pMultiCounter self = NULL;
|
||||||
|
|
||||||
|
pCount = (pCounter) pData;
|
||||||
|
if (pCount != NULL) {
|
||||||
|
self = (pMultiCounter) pCount->pDriv->pData;
|
||||||
|
}
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
for (i = 0; i < self->nSlaves; i++) {
|
||||||
|
ReleaseCountLock(self->slaves[i]);
|
||||||
|
}
|
||||||
|
ReleaseCountLock(pCount->pCountInt);
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
static int HMCStatus_ANSTO(void *pData, SConnection *pCon)
|
static int HMCStatus_ANSTO(void *pData, SConnection *pCon)
|
||||||
// A slightly modified version of the original HMCStatus(),
|
// A slightly modified version of the original HMCStatus(),
|
||||||
// to support pause-on-count-terminate option for ANSTO HM,
|
// to support pause-on-count-terminate option for ANSTO HM,
|
||||||
@@ -50,9 +77,19 @@ static int HMCStatus_ANSTO(void *pData, SConnection *pCon)
|
|||||||
// we need to call AnstoHttpPause() via the histmem Pause
|
// we need to call AnstoHttpPause() via the histmem Pause
|
||||||
if (((pHMcontrol_ANSTO)pData)->Pause_HM_After_Count==1) {
|
if (((pHMcontrol_ANSTO)pData)->Pause_HM_After_Count==1) {
|
||||||
ANSTO_HTTP_PAUSE = 1;
|
ANSTO_HTTP_PAUSE = 1;
|
||||||
self->pCount->Pause(self,pCon);
|
/* ffr: M.K. Introduced counter locking so we must release locks on the
|
||||||
|
* beam monitor multicounter (ie slave[0]) as well as the hmc controller.
|
||||||
|
* The lock on hmm gets released by histmem.c:HistCountStatus() because
|
||||||
|
* anstohttp.c:AnstoHttpStatus() returns HWIdle when the histogram server
|
||||||
|
* returns "Paused".
|
||||||
|
* NOTE: The multicounter must be slave 0 since we have already assumed
|
||||||
|
* that slaves >= 1 are histogram memories (see Warning below).
|
||||||
|
*/
|
||||||
|
self->pCount->Pause(self,pCon);
|
||||||
|
releaseMCntrLocks(self->slaveData[0]);
|
||||||
|
ReleaseCountLock(self->pCount); // Release hmc
|
||||||
} else
|
} else
|
||||||
self->pCount->Halt(self);
|
self->pCount->Halt(self);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Warning: this assumes that slaves 1 - MAXSLAVE are histogram memories.
|
Warning: this assumes that slaves 1 - MAXSLAVE are histogram memories.
|
||||||
|
|||||||
Reference in New Issue
Block a user