Revert "dbCa: iocInit wait for local CA links to connect"
This reverts commit a46bd5ae88.
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
### iocInit wait for local CA links to connect
|
||||
|
||||
PR [713](https://github.com/epics-base/epics-base/pull/713)
|
||||
|
||||
During iocInit(), wait for local CA links to connect.
|
||||
With this change, database authors can be certain that
|
||||
any local CA link is connected prior to `initHookAfterIocRunning`
|
||||
and `field(PINI, RUNNING)`.
|
||||
@@ -40,7 +40,6 @@
|
||||
/* We can't include dbStaticLib.h here */
|
||||
#define dbCalloc(nobj,size) callocMustSucceed(nobj,size,"dbCalloc")
|
||||
|
||||
#include <epicsAtomic.h>
|
||||
#include "db_access_routines.h"
|
||||
#include "dbCa.h"
|
||||
#include "dbCaPvt.h"
|
||||
@@ -65,7 +64,6 @@ extern int dbServiceIsolate;
|
||||
static ELLLIST workList = ELLLIST_INIT; /* Work list for dbCaTask */
|
||||
static epicsMutexId workListLock; /*Mutual exclusions semaphores for workList*/
|
||||
static epicsEventId workListEvent; /*wakeup event for dbCaTask*/
|
||||
static size_t initOutstanding;
|
||||
static int removesOutstanding = 0;
|
||||
#define removesOutstandingWarning 10000
|
||||
|
||||
@@ -342,7 +340,7 @@ static void dbCaLinkInitImpl(int isolate)
|
||||
dbCaCtl = ctlPause;
|
||||
|
||||
dbCaWorker = epicsThreadCreateOpt("dbCaLink", dbCaTask, NULL, &opts);
|
||||
/* wait for worker to startup, initialize dbCaClientContext, and connect local CA */
|
||||
/* wait for worker to startup and initialize dbCaClientContext */
|
||||
epicsEventMustWait(startStopEvent);
|
||||
}
|
||||
|
||||
@@ -371,12 +369,11 @@ void dbCaPause(void)
|
||||
epicsEventSignal(workListEvent);
|
||||
}
|
||||
}
|
||||
void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink,
|
||||
dbCaCallback connect, dbCaCallback monitor, void *userPvt,
|
||||
unsigned flags)
|
||||
|
||||
void dbCaAddLinkCallback(struct link *plink,
|
||||
dbCaCallback connect, dbCaCallback monitor, void *userPvt)
|
||||
{
|
||||
caLink *pca;
|
||||
(void)locker; /* Passed for symmetry with dbDbAddLink(). So far unused. */
|
||||
|
||||
assert(!plink->value.pv_link.pvt);
|
||||
|
||||
@@ -388,10 +385,6 @@ void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink,
|
||||
pca->connect = connect;
|
||||
pca->monitor = monitor;
|
||||
pca->userPvt = userPvt;
|
||||
pca->flags = flags;
|
||||
|
||||
if(flags & DBCA_CALLBACK_INIT_WAIT)
|
||||
epicsAtomicIncrSizeT(&initOutstanding);
|
||||
|
||||
epicsMutexMustLock(pca->lock);
|
||||
plink->lset = &dbCa_lset;
|
||||
@@ -401,22 +394,15 @@ void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink,
|
||||
epicsMutexUnlock(pca->lock);
|
||||
}
|
||||
|
||||
void dbCaAddLinkCallback(struct link *plink,
|
||||
dbCaCallback connect, dbCaCallback monitor, void *userPvt)
|
||||
{
|
||||
dbCaAddLinkCallbackOpt(NULL, plink, connect, monitor, userPvt, 0);
|
||||
}
|
||||
|
||||
long dbCaAddLink(struct dbLocker *locker, struct link *plink, short dbfType)
|
||||
{
|
||||
dbCaAddLinkCallbackOpt(locker, plink, 0, 0, NULL, 0);
|
||||
dbCaAddLinkCallback(plink, 0, 0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dbCaRemoveLink(struct dbLocker *locker, struct link *plink)
|
||||
{
|
||||
caLink *pca = (caLink *)plink->value.pv_link.pvt;
|
||||
(void)locker; /* Passed for symmetry with dbDbRemoveLink(). So far unused. */
|
||||
|
||||
if (!pca) return;
|
||||
epicsMutexMustLock(pca->lock);
|
||||
@@ -976,10 +962,6 @@ static void eventCallback(struct event_handler_args arg)
|
||||
}
|
||||
}
|
||||
done:
|
||||
if(pca->flags & DBCA_CALLBACK_INIT_WAIT) {
|
||||
pca->flags &= ~DBCA_CALLBACK_INIT_WAIT;
|
||||
addAction(pca, CA_INIT_WAIT);
|
||||
}
|
||||
epicsMutexUnlock(pca->lock);
|
||||
if (monitor) monitor(userPvt);
|
||||
}
|
||||
@@ -1117,9 +1099,7 @@ static void dbCaTask(void *arg)
|
||||
dbCaClientContext = ca_current_context ();
|
||||
SEVCHK(ca_add_exception_event(exceptionCallback,NULL),
|
||||
"ca_add_exception_event");
|
||||
if(epicsAtomicGetSizeT(&initOutstanding)==0)
|
||||
epicsEventSignal(startStopEvent);
|
||||
// else: defer to CA_INIT_WAIT
|
||||
epicsEventSignal(startStopEvent);
|
||||
|
||||
/* channel access event loop */
|
||||
while (TRUE){
|
||||
@@ -1275,9 +1255,6 @@ static void dbCaTask(void *arg)
|
||||
db_process(prec);
|
||||
dbScanUnlock(prec);
|
||||
}
|
||||
if ((link_action & CA_INIT_WAIT) && epicsAtomicDecrSizeT(&initOutstanding)==0) {
|
||||
epicsEventSignal(startStopEvent);
|
||||
}
|
||||
}
|
||||
SEVCHK(ca_flush_io(), "dbCaTask");
|
||||
}
|
||||
|
||||
@@ -21,19 +21,6 @@
|
||||
#include "epicsMutex.h"
|
||||
#include "epicsTypes.h"
|
||||
#include "link.h"
|
||||
#include "shareLib.h"
|
||||
#include "libCaAPI.h"
|
||||
|
||||
#ifndef INC_cadef_H
|
||||
/* Copy some definitions so this header to be included from
|
||||
* places where cadef.h and db_access.h can not.
|
||||
*/
|
||||
typedef void * chid;
|
||||
typedef void * evid;
|
||||
LIBCA_API extern const unsigned short dbr_value_size[];
|
||||
LIBCA_API short epicsShareAPI ca_field_type (chid chan);
|
||||
#define MAX_UNITS_SIZE 8
|
||||
#endif
|
||||
|
||||
/* link_action mask */
|
||||
#define CA_CLEAR_CHANNEL 0x1
|
||||
@@ -45,7 +32,6 @@ LIBCA_API short epicsShareAPI ca_field_type (chid chan);
|
||||
#define CA_GET_ATTRIBUTES 0x40
|
||||
#define CA_SYNC 0x1000
|
||||
#define CA_DBPROCESS 0x2000
|
||||
#define CA_INIT_WAIT 0x4000
|
||||
/* write type */
|
||||
#define CA_PUT 0x1
|
||||
#define CA_PUT_CALLBACK 0x2
|
||||
@@ -77,7 +63,6 @@ typedef struct caLink
|
||||
dbCaCallback connect;
|
||||
dbCaCallback monitor;
|
||||
void *userPvt;
|
||||
unsigned flags;
|
||||
/* The following are for write request */
|
||||
short putType;
|
||||
dbCaCallback putCallback;
|
||||
@@ -112,10 +97,4 @@ typedef struct caLink
|
||||
unsigned long nUpdate;
|
||||
}caLink;
|
||||
|
||||
#define DBCA_CALLBACK_INIT_WAIT (1)
|
||||
|
||||
void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink,
|
||||
dbCaCallback connect, dbCaCallback monitor,
|
||||
void *userPvt, unsigned flags);
|
||||
|
||||
#endif /* INC_dbCaPvt_H */
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "dbAccessDefs.h"
|
||||
#include "dbAddr.h"
|
||||
#include "dbBase.h"
|
||||
#include "dbCaPvt.h"
|
||||
#include "dbCa.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbConstLink.h"
|
||||
#include "dbDbLink.h"
|
||||
@@ -125,9 +125,7 @@ void dbInitLink(struct link *plink, short dbfType)
|
||||
if (dbfType == DBF_INLINK)
|
||||
plink->value.pv_link.pvlMask |= pvlOptInpNative;
|
||||
|
||||
int isLocal = dbChannelTest(plink->value.pv_link.pvname)==0;
|
||||
|
||||
dbCaAddLinkCallbackOpt(NULL, plink, NULL, NULL, NULL, isLocal ? DBCA_CALLBACK_INIT_WAIT : 0);
|
||||
dbCaAddLink(NULL, plink, dbfType);
|
||||
if (dbfType == DBF_FWDLINK) {
|
||||
char *pperiod = strrchr(plink->value.pv_link.pvname, '.');
|
||||
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
#include "dbEvent.h"
|
||||
#include "shareLib.h"
|
||||
|
||||
/* Declarations from cadef.h and db_access.h which we can't include here */
|
||||
typedef void * chid;
|
||||
typedef void * evid;
|
||||
epicsShareExtern const unsigned short dbr_value_size[];
|
||||
epicsShareExtern short epicsShareAPI ca_field_type (chid chan);
|
||||
#define MAX_UNITS_SIZE 8
|
||||
|
||||
#include "dbCaPvt.h"
|
||||
#include "errlog.h"
|
||||
#include "testMain.h"
|
||||
|
||||
Reference in New Issue
Block a user