Exemple #1
0
        internal void ReleaseCounter(Counter counter)
        {
            _clientLock.Lock();
            try
            {
                if (_isTerminating || _isClosed)
                {
                    return;
                }

                EnsureNotReentrant();

                long registrationId = counter.RegistrationId;


                var resource = _resourceByRegIdMap[registrationId];
                _resourceByRegIdMap.Remove(registrationId);
                if (counter == resource)
                {
                    _asyncCommandIdSet.Add(_driverProxy.RemoveCounter(registrationId));
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }
Exemple #2
0
        internal void ReleaseCounter(Counter counter)
        {
            _clientLock.Lock();
            try
            {
                EnsureActive();
                EnsureNotReentrant();

                long registrationId = counter.RegistrationId;

                if (_resourceByRegIdMap.Remove(registrationId))
                {
                    AwaitResponse(_driverProxy.RemoveCounter(registrationId));
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }
Exemple #3
0
        internal virtual void ReleaseCounter(Counter counter)
        {
            _clientLock.Lock();
            try
            {
                if (!counter.IsClosed())
                {
                    counter.InternalClose();

                    EnsureOpen();

                    long registrationId = counter.RegistrationId();
                    AwaitResponse(_driverProxy.RemoveCounter(registrationId));
                    _resourceByRegIdMap.Remove(registrationId);
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }