Spawn Multiple Threads for work then wait until all finished

后端 未结 12 1565
遇见更好的自我
遇见更好的自我 2020-11-28 01:46

just want some advice on \"best practice\" regarding multi-threading tasks.

as an example, we have a C# application that upon startup reads data from various \"type

12条回答
  •  臣服心动
    2020-11-28 02:03

    If you have more than 64 wait handles for an STA Thread as Mark says. you could create a list with your threads and wait for all to complete in a second loop.

    //check that all threads have completed.
    foreach (Thread thread in threadList)
    {
         thread.Join();
    
    }  
    

提交回复
热议问题