Boost logo

Boost Users :

Subject: Re: [Boost-users] ASIO: custom service which works with spawn/yield
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-07-25 17:12:54

On Wed, Jul 25, 2018 at 7:25 AM, Cristian Morales Vega via Boost-users
<boost-users_at_[hidden]> wrote:
> The following simplified sample shows the problem:

First of all thank you for posting a minimal, complete, and verifiable example.

It looks like your implementation of async_method() is missing one or
two executor_work_guard objects:

Per N4734[1] Outstanding Work []

    1. Until the asynchronous operation has completed, the
asynchronous operation shall maintain:

    (1.1) — an object work1 of type executor_work_guard, initialized
as work1(ex1), and where work1.owns_work() == true; and

    (1.2) — an object work2 of type executor_work_guard, initialized
as work2(ex2), and where work2.owns_work() == true.

I don't think you can get away with just calling `post` from
`async_method` you need to write a "real" composed operation class
with all of the bells and whistles including forwarding of the
associated executor and associated allocator. In this class you can
store the two required executor_work_guard objects as data members.

A tutorial for writing composed operations may be found here:



[1] <>

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at