Ok, I should have known the answer, but ...
I want to perform several different tasks in parallel on a separate thread and wait for all threads to complete before continuing. I know that I could use ThreadPool.QueueUserWorkItem() or BackgroundWorker , but did not want to use any (for no special reason).
So, is the code below the correct way to execute tasks in parallel in the background thread and wait for the completion of their processing?
Thread[] threads = new Thread[3]; for (int i = 0; i < threads.Length; i++) { threads[i] = new Thread(SomeActionDelegate); threads[i].Start(); } for (int i = 0; i < threads.Length; i++) { threads[i].Join(); }
I know this question had to be asked 100 times before thanks for your reply and patience.
source share