multi-threading question !

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

Guest

Hi,

I have a scenario wherein my parent app (dll) needs to make multiple Web
Service calls. Since the web service calls are independent, I thought that
triggering them off in different threads would be a better idea and save the
overall component execution time. The main component thread would wait for
all the thread to finish execution and then complete the processing
requirement. Based on my understanding I am under the impression that
"semaphores" is the way to go..

I have seen examples of how to initialize, increment and release a semaphore
usage. I'm stuck however in how do I make the parent thread wait for all the
threads to complete execution ?

Regards.
 
Hi,

I have a scenario wherein my parent app (dll) needs to make multiple Web
Service calls. Since the web service calls are independent, I thought that
triggering them off in different threads would be a better idea and save the
overall component execution time. The main component thread would wait for
all the thread to finish execution and then complete the processing
requirement. Based on my understanding I am under the impression that
"semaphores" is the way to go..

I have seen examples of how to initialize, increment and release a semaphore
usage. I'm stuck however in how do I make the parent thread wait for all the
threads to complete execution ?

Regards.

No need for a semaphore here. Just call the webservice method
asynchronously by invoking the BeginXXX and EndXXX version of the
call. It will return an IAsyncResult object that you can use to wait
for it to complete.
 
Back
Top