Skip to content
Snippets Groups Projects
Commit feac8e75 authored by benjamin.franksen's avatar benjamin.franksen
Browse files

seq: renamed struct members related to connection and monitor count

parent 8e81244b
No related branches found
No related tags found
No related merge requests found
......@@ -127,7 +127,7 @@ struct db_channel
pvVar pvid; /* PV (process variable) id */
unsigned dbCount; /* actual count for db access */
boolean connected; /* whether channel is connected */
boolean gotOneMonitor; /* whether got at least one monitor */
boolean gotMonitor; /* whether we got a monitor after connect */
PVMETA metaData; /* meta data (shared buffer) */
PVMETA *ssMetaData; /* array of meta data,
one for each state set (safe mode) */
......@@ -196,8 +196,8 @@ struct program_instance
unsigned assignCount; /* number of channels assigned to ext. pv */
unsigned connectCount; /* number of channels connected */
unsigned monitorCount; /* number of channels monitored */
unsigned firstMonitorCount; /* number of channels that received
at least one monitor event */
unsigned gotMonitorCount;/* number of monitored channels that got
a monitor event */
void *pvReqPool; /* freeList for pv requests (has own lock) */
boolean die; /* flag set when seqStop is called */
......
......@@ -102,7 +102,7 @@ pvStat seq_connect(SPROG *sp, boolean wait)
ac = sp->assignCount;
mc = sp->monitorCount;
cc = sp->connectCount;
gmc = sp->firstMonitorCount;
gmc = sp->gotMonitorCount;
epicsMutexUnlock(sp->programLock);
ready = ac == cc && mc == gmc;
......@@ -189,12 +189,12 @@ static void seq_mon_handler(
assert(dbch != NULL);
proc_db_events(value, type, ch, 0, pvEventMonitor, status);
if (!dbch->gotOneMonitor)
if (!dbch->gotMonitor)
{
dbch->gotOneMonitor = TRUE;
dbch->gotMonitor = TRUE;
epicsMutexMustLock(sp->programLock);
sp->firstMonitorCount++;
if (sp->firstMonitorCount == sp->monitorCount
sp->gotMonitorCount++;
if (sp->gotMonitorCount == sp->monitorCount
&& sp->connectCount == sp->assignCount)
{
epicsEventSignal(sp->ready);
......@@ -368,28 +368,30 @@ void seq_disconnect(SPROG *sp)
pvSysFlush(sp->pvSys);
}
pvStat seq_camonitor(CHAN *ch, boolean on)
pvStat seq_camonitor(CHAN *ch, boolean turn_on)
{
DBCHAN *dbch = ch->dbch;
pvStat status;
assert(ch);
assert(dbch);
if (on == pvMonIsDefined(dbch->pvid)) /* already done */
if (turn_on == pvMonIsDefined(dbch->pvid)) /* no change */
return pvStatOK;
DEBUG("calling pvVarMonitor%s(%p)\n", on?"On":"Off", dbch->pvid);
DEBUG("calling pvVarMonitor%s(%p)\n", turn_on ? "On" : "Off", ch);
dbch->gotOneMonitor = FALSE;
if (on)
if (turn_on)
{
status = pvVarMonitorOn(
&dbch->pvid, /* pvid */
ch->type->getType, /* requested type */
ch->count, /* element count */
ch); /* user arg (channel struct) */
}
else
status = pvVarMonitorOff(&dbch->pvid);
if (status != pvStatOK)
errlogSevPrintf(errlogFatal, "seq_camonitor: pvVarMonitor%s(var '%s', pv '%s') failure: %s\n",
on?"On":"Off", ch->varName, dbch->dbName, pvVarGetMess(dbch->pvid));
turn_on?"On":"Off", ch->varName, dbch->dbName, pvVarGetMess(dbch->pvid));
return status;
}
......@@ -444,7 +446,7 @@ void seq_conn_handler(int connected, void *arg)
unsigned dbCount;
dbch->connected = TRUE;
sp->connectCount++;
if (sp->firstMonitorCount == sp->monitorCount
if (sp->gotMonitorCount == sp->monitorCount
&& sp->connectCount == sp->assignCount)
{
epicsEventSignal(sp->ready);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment