private void SignalOrReset() { // Should be invoked under lock only if (_connections.Count == 0) { // no connections are available, clear the signal flag _semaphoreSlimSignalable.Reset(); } else { // signal that connections are available _semaphoreSlimSignalable.Signal(); } }
public void SetReady() { lock (_poolState) { var targetState = _settings.IsPausable ? State.Ready : State.ReadyNonPausable; if (_poolState.TransitionState(targetState)) { _maxConnectionsQueue.Reset(); _readyEventHandler?.Invoke(new ConnectionPoolReadyEvent(_serverId, _settings)); _maintenanceHelper.Start(); } } }