コード例 #1
0
        private void AddClients()
        {
            DateTime startTaskTime;
            TimeSpan spentTime;

            startTaskTime = DateTime.Now;

            if (clientsAddQueue.Count > 0)
            {
                lock (clientsAddQueue.SyncRoot)
                {
                    while (clientsAddQueue.Count > 0)
                    {
                        GameClient client = (GameClient)clientsAddQueue.Dequeue();
                        clients.Add(client.ConnectionID, client);
                        client.StartConnection();
                    }
                }
            }
            spentTime = DateTime.Now - startTaskTime;
            if (spentTime.TotalSeconds > 3)
            {
                Logging.WriteLine("GameClientManager.AddClients spent: " + spentTime.TotalSeconds + " seconds in working.");
            }
        }