private void Process() { while (ContinueProcess) { ClientHandler client = null; lock (ConnectionPool.SyncRoot) { if (ConnectionPool.Count > 0) { client = ConnectionPool.Dequeue(); } } if (client != null) { client.Process(); // Provoke client // if client still connect, schedufor later processingle it if (client.Alive) { ConnectionPool.Enqueue(client); } } Thread.Sleep(100); } }
void Process() { while (ContinueProcess) { ClientHandler client = null; lock (ConnectionPool.SyncRoot) { if (ConnectionPool.Count > 0) { client = ConnectionPool.Dequeue(); } } if (client != null) { client.Process(); if (client.Alive) { ConnectionPool.Enqueue(client); } } Thread.Sleep(1); } }