views:

68

answers:

2

Hi All,

I have a requirement in which i need to call webservice 12 times for one request. What i am planning creating that number of threads and call the service from ThreadStartMethod ... Now the questions are

  1. I need to kill all other threads if i got proper result from any of the response
  2. I heard killing thread by using Thread.abort is dangerous .

Please advice

Thanks

+2  A: 

Don't use threads at all. See my answer to this question here:

http://stackoverflow.com/questions/1753946/using-threadpool-threads-with-long-running-ado-net-queries-is-this-scalable/1754002#1754002

Use asp.net's built-in async processing instead.

No Refunds No Returns
Thanks ???? thats the right approach .... :)
prakash
A: 

Thread.abort will throw an ThreadAbortException and is usually not a very good idea, since aborting a thread will always leave your application in an undefined state.
It's considered to be better practice to do some sort of polling to stop the thread in a more 'graceful' way when a flag is set.

Mez