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-27 02:15:37


2013/6/27 Arash Partow <arash_at_[hidden]>

> The trick is to click the link, read and comprehend the code example, at
> which point an astute individual may realize that CK has gone to a lot of
> effort to integrate coroutine semantics into stock asio within the context
> of C++11.
>

boost::asio:yield_context - uses internaly boost.coroutine
boost::fibers::asio::yield - uses internaly boost.fiber

both rely on boost.context

> 1. Do I use another library to provide the functionality I think I may
> need?
>

as I wrote it depends on your programming model - with coroutine-version
(boost::asio:yield_context) you only operate in the asio-related context
with fiber version (boost::fibers::asio::yield) you get a broader range of
usage == for instance the one-thread-for-one client (10k-problem) can
easliy be used with
boost.fiber + boost.asio (boost::fibers::asio::yield) without degrading
over-all performance (at a certain amount of threads scheduling overhead
inside the OS counts + context switching between threads).
you can use mutex, condition-vars .... to sync fibers etc.

> Oh and btw the example quoted above quite clearly deals with the OP's
> original problem in a clean, efficient and simple to understand manner and
> so to the many other examples related to timeouts in the asio example set,
> all it takes is a bit of tinkering.
>

boost.fiber contains this example adapted to use boost.fiber



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