摘要: C#多线程及控制线程数量,对for循环输出效率。虽然输出不规律,但是效率明显提高。思路:如果要删除1000条数据,只使用for循环,则一个接着一个输出。所以,把1000条数据分成seed段,每段10条数据。int seed = Convert.ToInt32(createCount.Value) % 10 == 0 ? Convert.ToInt32(createCount.Value) / 10 : Convert.ToInt32(createCount.Value) / 10 + 1;注:createCount.Value的值是具体输出数据的数量这里把数据分配给seed个线程去处理,每个线 阅读全文
posted @ 2012-12-07 16:16 StupidsCat 阅读(19088) 评论(4) 推荐(0) 编辑