Kazz
Thanks for quick reply. Now I understand that you can only set value once for a promise. How can we modify the existing example, that which ever worker thread has finished and called the set_value(), the next set_value() call gets ignored. One solution (plz correct me here if wrong) could be to wrap both set_value() with try catch block. Is there any other solution to get a final result from multiple or thread pools and once the result is obtained, discarding further calls to set_value() ?
Using try/catch is the most straightforward way to do this. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976