diff --git a/src/ca/access.c b/src/ca/access.c index 2adc517d8..82d9e67c9 100644 --- a/src/ca/access.c +++ b/src/ca/access.c @@ -99,6 +99,11 @@ /************************************************************************/ /* * $Log$ + * Revision 1.107.2.8 2002/03/08 00:25:08 jhill + * fixed bug where the db_put_field in the local event callback stub was supplied + * with a destination that was the database field. In situations where the dbAccess + * db_access field types were different the database was damaged. + * * Revision 1.107.2.7 2001/09/18 12:17:48 mrk * increased stack size for cac_recv_task from 4096 to 8192 * @@ -1693,6 +1698,7 @@ const void *usrarg ppn->dbPutNotify.pbuffer = (ppn+1); } ppn->busy = TRUE; + ppn->onExtraLaborQueue = FALSE; ppn->caUserCallback = pfunc; ppn->caUserArg = (void *) usrarg; ppn->dbPutNotify.nRequest = count; @@ -1792,6 +1798,7 @@ LOCAL void ca_put_notify_action(PUTNOTIFY *ppn) * one client on another client). */ semTake(pcas->ca_putNotifyLock, WAIT_FOREVER); + pcapn->onExtraLaborQueue = TRUE; ellAdd(&pcas->ca_putNotifyQue, &pcapn->node); semGive(pcas->ca_putNotifyLock); @@ -2690,6 +2697,16 @@ int epicsShareAPI ca_clear_channel (chid pChan) if(ppn->busy){ dbNotifyCancel(&ppn->dbPutNotify); } + + semTake (ca_static->ca_putNotifyLock, WAIT_FOREVER); + if ( ppn->onExtraLaborQueue ) { + ellDelete( &ca_static->ca_putNotifyQue, &ppn->node ); + } + semGive (ca_static->ca_putNotifyLock); + + status = db_flush_extra_labor_event (ca_static->ca_evuser ); + assert ( status == OK ); + free(ppn); } diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index bb6723e9f..6b147dab7 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -33,6 +33,9 @@ /* * $Log$ + * Revision 1.74.4.3 2000/11/30 22:07:51 jhill + * changes from Ken Evans + * * Revision 1.74.4.2 1999/09/02 21:12:18 jhill * use (void) and not () in func proto when its not a C++ file * @@ -375,7 +378,8 @@ typedef struct caclient_put_notify{ void (*caUserCallback)(struct event_handler_args); void *caUserArg; struct CA_STATIC *pcas; - int busy; + char busy; + char onExtraLaborQueue; }CACLIENTPUTNOTIFY; #endif /*vxWorks*/ diff --git a/src/ca/vxWorks_depen.c b/src/ca/vxWorks_depen.c index d9c75ae51..fc3996298 100644 --- a/src/ca/vxWorks_depen.c +++ b/src/ca/vxWorks_depen.c @@ -29,6 +29,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.39.4.5 2002/03/13 22:07:58 jhill + * improved put notify cleanup when client terminates + * * Revision 1.39.4.4 2002/03/08 00:16:27 jhill * check for floating point in correct place * @@ -912,6 +915,7 @@ LOCAL void ca_extra_event_labor (void *pArg) */ semTake (ca_static->ca_putNotifyLock, WAIT_FOREVER); ppnb = (CACLIENTPUTNOTIFY *) ellGet (&ca_static->ca_putNotifyQue); + ppnb->onExtraLaborQueue = FALSE; semGive (ca_static->ca_putNotifyLock); /* diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index c47388861..20a17e06b 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -1318,6 +1318,7 @@ LOCAL void write_notify_call_back(PUTNOTIFY *ppn) * one client on another client). */ FASTLOCK(&pclient->putNotifyLock); + pciu->pPutNotify->onExtraLaborQueue = TRUE; ellAdd(&pclient->putNotifyQue, &pciu->pPutNotify->node); FASTUNLOCK(&pclient->putNotifyLock); @@ -1354,6 +1355,7 @@ void write_notify_reply(void *pArg) */ FASTLOCK(&pClient->putNotifyLock); ppnb = (RSRVPUTNOTIFY *)ellGet(&pClient->putNotifyQue); + ppnb->onExtraLaborQueue = FALSE; FASTUNLOCK(&pClient->putNotifyLock); /* * break to loop exit @@ -1533,6 +1535,7 @@ struct client *client } pciu->pPutNotify->busy = TRUE; + pciu->pPutNotify->onExtraLaborQueue = FALSE; pciu->pPutNotify->msg = *mp; pciu->pPutNotify->dbPutNotify.nRequest = mp->m_count; #ifdef CONVERSION_REQUIRED @@ -1715,9 +1718,14 @@ struct client *client * if a put notify is outstanding then cancel it */ if(pciu->pPutNotify){ - if(pciu->pPutNotify->busy){ - dbNotifyCancel(&pciu->pPutNotify->dbPutNotify); - } + if( pciu->pPutNotify->busy ){ + dbNotifyCancel(&pciu->pPutNotify->dbPutNotify); + } + FASTLOCK(&client->putNotifyLock); + if ( pciu->pPutNotify->onExtraLaborQueue ) { + ellDelete ( &client->putNotifyQue, &pciu->pPutNotify->node ); + } + FASTUNLOCK(&client->putNotifyLock); } while (TRUE){ diff --git a/src/rsrv/server.h b/src/rsrv/server.h index ac3ab8493..bb379698f 100644 --- a/src/rsrv/server.h +++ b/src/rsrv/server.h @@ -150,7 +150,8 @@ typedef struct rsrv_put_notify{ PUTNOTIFY dbPutNotify; caHdr msg; unsigned long valueSize; /* size of block pointed to by dbPutNotify */ - int busy; /* put notify in progress */ + char busy; /* put notify in progress */ + char onExtraLaborQueue; }RSRVPUTNOTIFY;