Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] How to deal with no-connect and/or read-timeout
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2013-06-26 02:48:39


2013/6/25 Nat Linden <nat_at_[hidden]>

> 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);



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net