Threading and Events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi am writing an application which involves a long loop inside a loop. this
loop can work independently too. so i want to do something like this

for(int i=0;i<5000;i++){
if(some Condition){
raiseEvent
}
}

//in event handler
Thread t=new Thread(this.somemethod);
t.Start()l

//in somemethod
some very log process

So what are the problems i am going to run into.
Whats the better alternative
 
Hi am writing an application which involves a long loop inside a loop. this
loop can work independently too. so i want to do something like this

for(int i=0;i<5000;i++){
if(some Condition){
raiseEvent
}
}

//in event handler
Thread t=new Thread(this.somemethod);
t.Start()l

//in somemethod
some very log process

So what are the problems i am going to run into.
Whats the better alternative

Are these sub tasks long runing tasks? If they aren't, then I would
suggest maybe using the ThreadPool calss's QueueUserWorkItem method to
initiate queue the tasks you want to run....
 
Back
Top