P
P
prog3232014-04-18 22:44:24
C++ / C#
prog323, 2014-04-18 22:44:24

How to find out in c# that all threads have completed?

I create max_threads threads

for (int live_thread = 0; live_thread < max_threads; live_thread++) 
{    
                 Thread t = new Thread(поток); 
      t.Start(live_thread);    
}

How to know that all threads have completed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexP11223, 2014-04-18
@AlexP11223

Save them to a list and watch IsAlive? Or make a counter. See what the goal is.
In general, .NET has had a bunch of more convenient / high-level ways to work with parallelization for a long time, most likely you should look at them. Task, async/await, Rx, ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question