Beispiel #1
0
        public void Return(Socket s)
        {
            SocketBag bag = new SocketBag(s, DateTime.Now);

            lock (this.queue)
            {
                this.queue.Enqueue(bag);
            }
        }
Beispiel #2
0
        public Socket Get()
        {
            SocketBag bag = null;

            lock (this.queue)
            {
                if (this.queue.Count > 0)
                {
                    bag = this.queue.Dequeue();
                }
            }

            if (bag != null)
            {
                return(bag.socket);
            }

            return(GetNew());
        }