new subscription member func preventing subscription from being installed twice

This commit is contained in:
Jeff Hill
2004-03-22 18:38:29 +00:00
parent ebfded8107
commit 16e182a89c
3 changed files with 19 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ netSubscription::netSubscription (
unsigned maskIn, cacStateNotify & notifyIn ) :
count ( countIn ), privateChanForIO ( chanIn ),
notify ( notifyIn ), type ( typeIn ), mask ( maskIn ),
updateWhileDisconnected ( false )
updateWhileDisconnected ( false ), subscribed ( false )
{
if ( ! dbr_type_is_valid ( typeIn ) ) {
throw cacChannel::badType ();
@@ -93,6 +93,9 @@ void netSubscription::exception (
epicsGuard < epicsMutex > & guard, cacRecycle & recycle,
int status, const char * pContext )
{
if ( status == ECA_DISCONN ) {
this->subscribed = false;
}
if ( status == ECA_CHANDESTROY ) {
this->notify.exception (
guard, status, pContext, UINT_MAX, 0 );
@@ -118,6 +121,9 @@ void netSubscription::exception (
cacRecycle & recycle, int status, const char * pContext,
unsigned typeIn, arrayElementCount countIn )
{
if ( status == ECA_DISCONN ) {
this->subscribed = false;
}
if ( status == ECA_CHANDESTROY ) {
this->notify.exception (
guard, status, pContext, UINT_MAX, 0 );
@@ -154,6 +160,16 @@ void netSubscription::completion (
}
}
void netSubscription::subscribeIfRequired (
epicsGuard < epicsMutex > & guard, nciu & chan )
{
if ( ! this->subscribed ) {
chan.getPIIU(guard)->subscriptionRequest (
guard, chan, *this );
this->subscribed = true;
}
}
void netSubscription::subscriptionUpdateIfRequired (
epicsGuard < epicsMutex > & guard, nciu & chan )
{