Date: 2004-09-08 04:21:49
In a related vein, I have been working on a generic functionality to launch asynchronous functions be it in another thread, another process or even out-of-box. The key is the definition of a set of asynchronous function traits allowing a number of free functions such as run_task() wait_task() and task_result() to be presented.
One might for instance have something like to run a task on a different thread
// Assuming boost::threader is defined and != boost:thread
// The following line will launch a function on a separate thread using boost:thread.
task_id<boost::threader> id= run_task( boost::threader(), boost::bind( my_dns_request, "www.boost.org" ) );
// do some work here
// and some time later wait for request to finish
wait_task( id );
By specialising the asynchronous function traits it can allow for requests to performed on another host via SOAP or in a RMI-lie fashion for instance.
Would anyone be interested in something like this?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk