Пример #1
0
        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();
        }
Пример #2
0
        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);
        }