-2
我已經動態地創建了線程。獲取線程在多線程中的狀態
static void Main(string[] args)
{
int ThreadCount =Convert.ToInt32ConfigurationManager.AppSettings["Threads"]);
List<Thread> th = new List<Thread>();
for (int i = 0; i < ThreadCount; i++)
{
Thread t = new Thread(print);
th.Add(t);
}
foreach (Thread t in th)
{
t.Start();
}
}
public static void print()
{
console.writeline("123");
}
我想知道這個線程何時會完成。 完成這些線程後,我想打印「完成」消息
我該怎麼做。
我認爲,在回答問題的第一部分,你應該把的foreach(VAR噸日) 噸。加入();而不是 –
哎呀,感謝您的更正。將編輯。 –