public void Return(PGSession session) { for (var i = 0; i < _sessions.Length; i++) { if (Interlocked.CompareExchange(ref _sessions[i], session, null) == null) { return; } } session.Dispose(); }
private async ValueTask <PGSession> CreateSession() { var session = new PGSession(_host, _port, _database, _user, _password); await session.StartAsync(); if (OnCreate != null) { await OnCreate.Invoke(session); } return(session); }