最近閒暇之余,來搞搞,多線程學習,只為下個項目做准備,隨著項目優化,開發,性能的考慮,慢慢要用到些以前不用的東西,先開始熟悉熟悉
先把東西放上來,歡迎大家賜教,比較好久木玩這東西了,肯定不完善,希望大家提出寶貴意見啊(嘿嘿~~)
大概功能描述:為了提高數據處理速度,把任務隊列分別交給不同子線程去完成,同時對啟動的新線程數量限制,避免線程數量過多照成機器卡殼
NowThCount = ; MaxThCount = ; RunNum = ; ( (NowThCount == && RunNum == (RunNum == && NowThCount != Thread.Sleep(); ; (NowThCount >= Thread.Sleep(); ; (RunNum > && NowThCount < RunNum-- NewTh = Thread( Console.WriteLine(+ NowThCount++; Console.WriteLine( + Thread.Sleep( Console.WriteLine( + Thread.CurrentThread.ManagedThreadId + NowThCount--; }
寫在最後:感覺程序還不打完善,運行中會不會因為特殊原因照成異常,還在測試中…..