diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index 472b1cfb2..73241e190 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -145,7 +145,9 @@ long jba_debug=0; long dbPut(); /* Added for Channel Access Links */ +long dbCaAddInlink(); long dbCaGetLink(); +long dbCommonInit(); #define MAX_LOCK 10 @@ -163,6 +165,23 @@ static struct { struct scanLock *pscanLock; /*addr of array of struct scanLock */ } dbScanPvt; +long dbCommonInit(struct dbCommon *precord, int pass) +{ + +long status; + + if (pass == 0) + status = 0L; + else + if (precord->sdis.type == PV_LINK) + status = dbCaAddInlink(&(precord->sdis), (void *) precord, "DISA"); + else + status = 0L; + + return status; + +} /* end dbCommonInit() */ + void dbScanLock(struct dbCommon *precord) { struct scanLock *pscanLock; @@ -314,7 +333,7 @@ all_done: } /* forward reference for pvdGetFld */ -struct fldDes *pvdGetFld(); +/* struct fldDes *pvdGetFld(); */ long dbNameToAddr(pname,paddr) char *pname; diff --git a/src/db/dbCaLink.c b/src/db/dbCaLink.c index 971c0c59c..3744fe87c 100644 --- a/src/db/dbCaLink.c +++ b/src/db/dbCaLink.c @@ -189,6 +189,7 @@ static void my_event_handler(); static struct input_pvar *pop_input_pvar(); static struct output_pvar *pop_output_pvar(); static long process_asynch_events(); +static void process_asynch_events_task(); static void push_input_pvar(); static void push_output_pvar(); static long queue_add_event_from_input_pvar(); @@ -875,6 +876,10 @@ BOOL done; status = task_initialize_channel_access(); + taskSpawn(DB_CA_PROC_ASYNCH_EV_TASK_NAME, DB_CA_PROC_ASYNCH_EV_TASK_PRI, + DB_CA_PROC_ASYNCH_EV_TASK_OPT, DB_CA_PROC_ASYNCH_EV_TASK_STACK, + (FUNCPTR) process_asynch_events_task, taskIdSelf()); + /* queueing ca_build_and_connect()'s */ for (po = Pvar_outputlist_hdr; @@ -974,9 +979,6 @@ BOOL done; FASTUNLOCK(&Buffer); - /* kludge suggested by Jeff Hill so that we can have reliable */ - /* connection management for vxWorks hosted CA clients */ - process_asynch_events((float) 0.1); } /* endif */ } /* endwhile */ } /* endif */ @@ -1867,6 +1869,41 @@ long rc; } /* end process_asynch_events() */ +/**************************************************************** +* +* static void process_asynch_events_task(parent_task_id) +* int parent_task_id; +* +* Description: +* issues a single call to process_asynch_events(0.0). this is a trick +* suggested by Jeff Hill so that connections that are lost may be +* re-connected when the other IOC is re-booted. without this trick, +* a lost connection to another IOC will remain lost, even if the other +* IOC successfully re-boots. +* +* Input: +* int parent_task_id vxWorks taskid of dbCaProcessOutlinks +* +* Output: None. +* +* Returns: +* +* Notes: +* +****************************************************************/ + +static void process_asynch_events_task(parent_task_id) +int parent_task_id; +{ + + ca_import(parent_task_id); + + /* kludge suggested by Jeff Hill so that we can have reliable */ + /* connection management for vxWorks hosted CA clients */ + process_asynch_events((float) 0.0); + +} /* end process_asynch_events_task() */ + /**************************************************************** * * static void push_input_pvar(ip) diff --git a/src/db/iocInit.c b/src/db/iocInit.c index 09c9dd2a5..f2bfd01be 100644 --- a/src/db/iocInit.c +++ b/src/db/iocInit.c @@ -88,6 +88,9 @@ int interruptAccept=FALSE; extern short wakeup_init; /*old IO_EVENT_SCAN*/ struct dbBase *pdbBase=NULL; +/* added for Channel Access Links */ +long dbCommonInit(); + /* define forward references*/ extern long dbRead(); long initDrvSup(); @@ -366,6 +369,7 @@ static long initDatabase() /* Init DSET NOTE that result may be NULL*/ precord->dset=(struct dset *)GET_PDSET(pdevSup,precord->dtyp); /* call record support init_record routine - First pass */ + rtnval = dbCommonInit(precord,0); if(!(recSup->papRset[i]->init_record)) continue; rtnval = (*(recSup->papRset[i]->init_record))(precord,0); if(status==0) status = rtnval; @@ -438,6 +442,7 @@ static long initDatabase() /* If NAME is null then skip this record*/ if(!(precord->name[0])) continue; + rtnval = dbCommonInit(precord,1); /* call record support init_record routine - Second pass */ if(!(recSup->papRset[i]->init_record)) continue; rtnval = (*(recSup->papRset[i]->init_record))(precord,1);