Original Post
Hi folks, A few days back I massaged my C++ library for calling functions and functors asynchronously in to what I hope is reasonable shape. If anybody's interested in checking it out, I'd love to get some feedback. Making an asynchronous call returns a 'future' immediately, which may be redeemed later on when the time is right. There are a number of other libraries that do similar things, but they seemed not to have very good support for propagating exceptions and/or passing and returning references. Usage looks something like this: There are a bunch of other related features which you can read about, if interested: async library. Cheers, Edd
using std::string;
using std::vector;
// A time-consuming function
string merge_xml_files(const vector<string> &files);
// An object used to catch exceptions, can be reused for
// any number of asynchronous calls
async::layered_cage<std::exception, xml_parse_error, async::catch_all> cage;
vector<string> xml_files;
// fill xml_files
// ...
// call merge_xml_files(xml_files) asynchronously
async::future<string> fut = async::call(cage, merge_xml_files, xml_files);
make_virtual_cup_of_coffee();
// ...
string merged_xml = fut.value();