Пример #1
0
        private void AddClients()
        {
            DateTime now = DateTime.Now;

            if (this.clientsAddQueue.Count > 0)
            {
                lock (this.clientsAddQueue.SyncRoot)
                {
                    while (this.clientsAddQueue.Count > 0)
                    {
                        GameClient gameClient = (GameClient)this.clientsAddQueue.Dequeue();
                        this.clients.Add(gameClient.ConnectionID, gameClient);
                        gameClient.StartConnection();
                    }
                }
            }
            TimeSpan timeSpan = DateTime.Now - now;

            if (timeSpan.TotalSeconds > 3.0)
            {
                Console.WriteLine("GameClientManager.AddClients spent: " + timeSpan.TotalSeconds + " seconds in working.");
            }
        }