[boost][asio] Waiting on a returned value run in another strand

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[boost][asio] Waiting on a returned value run in another strand

Boost - Users mailing list
Hello,

I'm trying to preform an asynchronous operation in order to obtain a connection from a pool of available connections. I'm trying to leverage strands for two reasons, 1) I don't need locks because I can guarantee that the connection pool access is limited to quick sequential access, and 2) I may need to wait for connections to become available, or I may need to actually make a connection.

I'm working with the 1.66 version of boost and I have been searching the internet for ANY answer to this question, so far none of the examples which I've located work any more. All of them simply fail to compile. For example, 


This uses an older version of boost.

So how can I do this under the newest version of boost.asio? 

Any help would be greatly appreciated.

--
thanks,
Brian Bartman. PhD

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [boost][asio] Waiting on a returned value run in another strand

Boost - Users mailing list
On 24/01/2018 02:33, Brian Bartman wrote:

> I'm trying to preform an asynchronous operation in order to obtain a
> connection from a pool of available connections. I'm trying to leverage
> strands for two reasons, 1) I don't need locks because I can guarantee
> that the connection pool access is limited to quick sequential access,
> and 2) I may need to wait for connections to become available, or I may
> need to actually make a connection.
>
> I'm working with the 1.66 version of boost and I have been searching the
> internet for ANY answer to this question, so far none of the examples
> which I've located work any more. All of them simply fail to compile.
> For example,
>
> http://coliru.stacked-crooked.com/a/7427ec669bf0e326 
> <http://coliru.stacked-crooked.com/a/7427ec669bf0e326>
>
> This uses an older version of boost.
>
> So how can I do this under the newest version of boost.asio?

I can't answer this directly since I haven't migrated to 1.66 yet
myself, but you might find the following link to be of use:

   http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/net_ts.html

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [boost][asio] Waiting on a returned value run in another strand

Boost - Users mailing list
All it really says is that there was a change to the interface, I'm really looking for what that change really is. I keep trying to look for an example within the ASIO code base but most of them are complicated, and not really easy to follow/boil down what I need. 

I did have one other question, that's semi-related to this, but is it possible to yield a coroutine into a different strand, do something and yield back to the original strand? If I can do this then I don't really need to make the coroutine truly wait for a return value.

On Wed, Jan 24, 2018 at 1:11 AM, Gavin Lambert via Boost-users <[hidden email]> wrote:
On 24/01/2018 02:33, Brian Bartman wrote:
I'm trying to preform an asynchronous operation in order to obtain a connection from a pool of available connections. I'm trying to leverage strands for two reasons, 1) I don't need locks because I can guarantee that the connection pool access is limited to quick sequential access, and 2) I may need to wait for connections to become available, or I may need to actually make a connection.

I'm working with the 1.66 version of boost and I have been searching the internet for ANY answer to this question, so far none of the examples which I've located work any more. All of them simply fail to compile. For example,

http://coliru.stacked-crooked.com/a/7427ec669bf0e326 <http://coliru.stacked-crooked.com/a/7427ec669bf0e326>

This uses an older version of boost.

So how can I do this under the newest version of boost.asio?

I can't answer this directly since I haven't migrated to 1.66 yet myself, but you might find the following link to be of use:

  http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/net_ts.html

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users



--
thanks,
Brian Bartman

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users