Join Threads Question  
Author Message
qt1h00





PostPosted: Visual C# General, Join Threads Question Top

Hello

I have 10 threads which i start that way:

for (int i = 0; i < 10; i++)

{

Thread newThread = new Thread(new ParameterizedThreadStart(BLABLA));

newThread.Start(LALALALA);

}

now i want to Join these 10 threads. how do i do it

(Sorry for the newbie question..)



Visual C#1  
 
 
SvenC





PostPosted: Visual C# General, Join Threads Question Top

Hi,

you have to define an array of thread objects to keep variables to call methods on:

Thread[] tt = new Thread[10];

for(int j = 0; j < 10; ++j)
{
  tt[j] = new Thread(new ParameterizedThreadStart(blabla));
}

for(int j = 0; j < 10; ++j)
{
  tt[j].Join();
}

--
SvenC