Stopping a Thread
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I'm writing a LoadGenerator application, in which for a specific period of time certain no.of Threads are created and executes simultaneously.. That i call as RampUp threads. After sleeping for a sustain period (10secs) of time.. I want to RampDown threads, that is i want to kill the threads one by one.. I have defined an ArrayList object
alThreads
to maintain the Threads list.. RampUp() methodpublic void RampUp() { for(int i=0; i<10; i++) { Thread thread = new Thread(ExecuteSingleThread); thread.Start(); if(alThread.Contains(thread) == false) { alThreads.Add(thread); } Thread.Sleep(5000); } }
The below code kills the thread every five second.. RampDown() method
public void RampDown() { for(int i=0;i
Now the problem is after killing the first thread, all the remaining threads doesn't executes the code inside it.. Please help me.. regards, nas