|
Boost : |
Subject: [boost] [asio][thread] asio and future callbacks
From: Will Manley (boost_at_[hidden])
Date: 2010-08-03 10:42:40
Hi All
I was thinking of implementing a futures service following the asio
model of callbacks. This would essentially allow integrating use of
futures in the event based model of asio. I would imagine a class like:
class futures_service
{
public:
futures_service(io_service& msg_queue);
/// Register for a callback when the value contained in that
/// future is ready. When the future is ready the handler will
/// get posted to the message queue in a manner equivalent to
/// calling io_service::dispatch.
///
/// Handler should be a functor with the signature:
/// void (Future_T&);
template <class Future_T, class Handler>
void wait_for_async(Future_T future, Handler cb);
};
The futures_service could be implemented using the same techniques as
boost::wait_for_any (thus would require access to private members of the
boost::future classes.
I have not come across anything like this in the boost libraries (either
in asio or threads). Has this been considered and rejected for some
reason? Would boost be interested in it if I were to write it? Which
library would it go into, thread or asio?
Thanks
Will
PS. I posted this to the asio and threads lists but got no response so
I'm trying here
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk