Click here to Skip to main content
15,891,375 members
Home / Discussions / C#
   

C#

 
Questiona query [modified] Pin
Nekshan19-Feb-07 20:40
Nekshan19-Feb-07 20:40 
AnswerRe: a query Pin
virendra patel19-Feb-07 21:00
virendra patel19-Feb-07 21:00 
GeneralRe: a query Pin
Nekshan19-Feb-07 21:55
Nekshan19-Feb-07 21:55 
AnswerRe: a query Pin
Guffa19-Feb-07 21:24
Guffa19-Feb-07 21:24 
AnswerRe: a query Pin
Sandeep Akhare19-Feb-07 21:37
Sandeep Akhare19-Feb-07 21:37 
GeneralRe: a query Pin
Nekshan19-Feb-07 22:01
Nekshan19-Feb-07 22:01 
GeneralRe: a query Pin
Sandeep Akhare19-Feb-07 22:20
Sandeep Akhare19-Feb-07 22:20 
QuestionStopping a Thread Pin
nasambur19-Feb-07 20:22
nasambur19-Feb-07 20:22 
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() method
public 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<alThreads.Count;i++)
  {
    Thread thread = (Thread)alThreads[i];
    if(thread.IsAlive)
      thread.Abort();
    Thread.Sleep(5000);
  }
}



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
QuestionHow to send back value to the Main WinForm? [modified] Pin
Khoramdin19-Feb-07 20:07
Khoramdin19-Feb-07 20:07 
AnswerRe: How to send back value to the Main WinForm? Pin
Martin#19-Feb-07 20:49
Martin#19-Feb-07 20:49 
GeneralRe: How to send back value to the Main WinForm? Pin
Khoramdin20-Feb-07 9:42
Khoramdin20-Feb-07 9:42 
GeneralRe: How to send back value to the Main WinForm? Pin
Martin#20-Feb-07 20:37
Martin#20-Feb-07 20:37 
AnswerRe: How to send back value to the Main WinForm? Pin
Rhys Gravell19-Feb-07 20:53
professionalRhys Gravell19-Feb-07 20:53 
Questiona query [modified] Pin
Nekshan19-Feb-07 19:51
Nekshan19-Feb-07 19:51 
AnswerRe: a query Pin
virendra patel19-Feb-07 20:05
virendra patel19-Feb-07 20:05 
GeneralRe: a query [modified] Pin
Nekshan19-Feb-07 20:39
Nekshan19-Feb-07 20:39 
AnswerRe: a query Pin
Sandeep Akhare19-Feb-07 20:08
Sandeep Akhare19-Feb-07 20:08 
GeneralRe: a query Pin
Nekshan19-Feb-07 20:16
Nekshan19-Feb-07 20:16 
GeneralRe: a query Pin
Sandeep Akhare19-Feb-07 20:22
Sandeep Akhare19-Feb-07 20:22 
AnswerRe: a query Pin
NanaAM19-Feb-07 20:11
NanaAM19-Feb-07 20:11 
GeneralRe: a query Pin
Nekshan19-Feb-07 20:17
Nekshan19-Feb-07 20:17 
GeneralRe: a query Pin
virendra patel19-Feb-07 20:34
virendra patel19-Feb-07 20:34 
AnswerRe: a query Pin
NanaAM19-Feb-07 21:56
NanaAM19-Feb-07 21:56 
AnswerRe: a query Pin
Russell Jones19-Feb-07 22:22
Russell Jones19-Feb-07 22:22 
QuestionError window Pin
hiremath7119-Feb-07 19:49
hiremath7119-Feb-07 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.