Esempio n. 1
0
        private Client GetClient()
        {
            Client client;

            lock (FreeClients)
            {
                client = FreeClients.Any() ? FreeClients.Dequeue() : null;
            }

            if (client != null)
            {
                lock (UsingClients) { UsingClients.Add(client); }
            }

            return(client);
        }
Esempio n. 2
0
        public void FreeClient(Client client)
        {
            lock (UsingClients) { UsingClients.Remove(client); }

            lock (FreeClients) { FreeClients.Enqueue(client); }
        }