Ajay Saxena wrote:You are very close to the solution!
Ajay Saxena wrote:
However,the solution is far from complete as you want the response to be generated when one of the threads is done with its job.
In the current implementation the three threads are being spawned by the parent thread and it's not blocking on the child threads.
Designing a solution where you would like the parent thread to block only till ONE of the threads is done,and then probably interrupt the remaining threads would be tricky.