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

seq: pvPut/GetComplete return TRUE in case of unassigned var

It is friendlier to just go on than to let the program hang.
Note that this is still a user error and a message is issued
to indicate it.
parent 04ec8d64
No related branches found
No related tags found
No related merge requests found
...@@ -225,19 +225,12 @@ epicsShareFunc boolean epicsShareAPI seq_pvGetComplete(SS_ID ss, VAR_ID varId) ...@@ -225,19 +225,12 @@ epicsShareFunc boolean epicsShareAPI seq_pvGetComplete(SS_ID ss, VAR_ID varId)
if (!ch->dbch) if (!ch->dbch)
{ {
if (sp->options & OPT_SAFE) /* Anonymous PVs always complete immediately */
{ if (!(sp->options & OPT_SAFE))
/* Anonymous PVs always complete immediately */
return TRUE;
}
else
{
errlogSevPrintf(errlogMajor, errlogSevPrintf(errlogMajor,
"pvGetComplete(%s): user error (variable not assigned)\n", "pvGetComplete(%s): user error (variable not assigned)\n",
ch->varName ch->varName);
); return TRUE;
return FALSE;
}
} }
switch (epicsEventTryWait(getSem)) switch (epicsEventTryWait(getSem))
...@@ -518,6 +511,7 @@ epicsShareFunc boolean epicsShareAPI seq_pvPutComplete( ...@@ -518,6 +511,7 @@ epicsShareFunc boolean epicsShareAPI seq_pvPutComplete(
boolean any, boolean any,
boolean *complete) boolean *complete)
{ {
SPROG *sp = ss->sprog;
boolean anyDone = FALSE, allDone = TRUE; boolean anyDone = FALSE, allDone = TRUE;
unsigned n; unsigned n;
...@@ -525,27 +519,39 @@ epicsShareFunc boolean epicsShareAPI seq_pvPutComplete( ...@@ -525,27 +519,39 @@ epicsShareFunc boolean epicsShareAPI seq_pvPutComplete(
{ {
epicsEventId putSem = ss->putSemId[varId+n]; epicsEventId putSem = ss->putSemId[varId+n];
boolean done = FALSE; boolean done = FALSE;
CHAN *ch = ss->sprog->chan + varId + n; CHAN *ch = sp->chan + varId + n;
switch (epicsEventTryWait(putSem)) if (!ch->dbch)
{ {
case epicsEventWaitOK: /* Anonymous PVs always complete immediately */
ss->putReq[varId] = NULL; if (!(sp->options & OPT_SAFE))
epicsEventSignal(putSem); errlogSevPrintf(errlogMajor,
check_connected(ch->dbch, metaPtr(ch,ss)); "pvPutComplete(%s): user error (variable not assigned)\n",
/* TODO: returning either TRUE or FALSE here seems wrong. We return TRUE, ch->varName);
so that state sets don't hang. Still means that user code has to check
status by calling pvStatus and/or pvMessage. */
done = TRUE; done = TRUE;
break; }
case epicsEventWaitTimeout: else
break; {
case epicsEventWaitError: switch (epicsEventTryWait(putSem))
ss->putReq[varId] = NULL; {
epicsEventSignal(putSem); case epicsEventWaitOK:
errlogSevPrintf(errlogFatal, "pvPutComplete(%s): " ss->putReq[varId] = NULL;
"epicsEventTryWait(putSem[%d]) failure\n", ch->varName, varId); epicsEventSignal(putSem);
break; check_connected(ch->dbch, metaPtr(ch,ss));
/* TODO: returning either TRUE or FALSE here seems wrong. We return TRUE,
so that state sets don't hang. Still means that user code has to check
status by calling pvStatus and/or pvMessage. */
done = TRUE;
break;
case epicsEventWaitTimeout:
break;
case epicsEventWaitError:
ss->putReq[varId] = NULL;
epicsEventSignal(putSem);
errlogSevPrintf(errlogFatal, "pvPutComplete(%s): "
"epicsEventTryWait(putSem[%d]) failure\n", ch->varName, varId);
break;
}
} }
anyDone = anyDone || done; anyDone = anyDone || done;
......
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