日期:2014-05-17  浏览次数:20868 次

请各位来帮我看下这段代码,分析一下啊。谢谢了

  //更新红绿灯状态
        public void UpdateLight(object obj)
        {
            try
            {
                Dictionary<string, string> dic_light = obj as Dictionary<string, string>;
                List<Dictionary<string, string>> dic_lights = new List<Dictionary<string, string>>();
                for (int i = 0; i < 4; i++)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (var item in dic_light)
                    {
                        if (Convert.ToInt32(item.Key) > i * 40 && Convert.ToInt32(item.Key) <= (i + 1) * 40)
                        {
                            dic.Add(item.Key, item.Value);
                        }
                    }
                    dic_lights.Add(dic);
                }
                for (int i = 0; i < dic_lights.Count; i++)
                {
                    Thread thread = new Thread(new ParameterizedThreadStart(DealLight));
                    thread.Start(dic_lights[i]);
                }
            }
            catch (Exception ex)
            {
         &nbs