Hello friends,
Kindly fo through the following code sample,
In this code, i want to stop execution till all the threads have complited their job. and i dont know how can i do this.
static ArrayList FarchedContent = new ArrayList();
public static string SearchContent(string KeyWord)
{
objThread = new Thread[20];
for (int i = 0; i < 20; i++)
{
objThread[ i ] = new Thread(new ThreadStart(FatchContent));
objThread[ i ].Priority = ThreadPriority.AboveNormal;
objThread[ i ].Start();
}
//Here I want to use FarchedContent but i want
to make sure that all the //above created threads
have complited their job.
// How can I do this
}
private static void FatchContent()
{
string str;
//some task;
// Assign content to str
FarchedContent.Add(str);
Thread.CurrentThread.Abort();
}
can any one know how can i do this
Rgds,
Kiran Suthar

How can i verify that all the threads are aborted ?
Thor Milde
Thanks for participating in the MSDN Forums. Unfortunately i detected that this is a double post, you are allready discussing this in a other thread: How to wait till all threads complete their job
So i will close this one and will ask for any more discussion, visit the other thread.
LukeSkywalker
If you want to be sure a thread has completed, call its Join() method, p.e. objThread.Join(); You should call this method for each of the threads you want to wait for.
If you want to abort threads, call their Abort() method.