2013/6/25 Nat Linden <nat@lindenlab.com>
You might also consider using Boost.Context to manage Asio state. I
think there are Context examples dealing with Asio.

Instead of boost.context I would suggest using boost.fiber (github.com/olk/boost-fiber).
The lib provides user-land threads (cooperative scheduling -> context switching) and integrates
into boost.asio's new async_result-feature (currently in trunk - might be available in boost-1.54).
boost.fiber contains some examples dealing with async_result (examples adapted from boost.asio):

                timer_.expires_from_now(
                    boost::posix_time::seconds( 3) );
                std::size_t n = socket_.async_read_some(
                    boost::asio::buffer( data),
                    boost::fibers::asio::yield);
                boost::asio::async_write(
                    socket_,
                    boost::asio::buffer( data, n),
                    boost::fibers::asio::yield);