Boost logo

Boost Users :

Subject: Re: [Boost-users] ASIO: Writing Composed Operations
From: Cristian Morales Vega (cristian_at_[hidden])
Date: 2019-01-25 15:50:28


On Thu, 6 Dec 2018 at 23:59, Damian Jarek <damian.jarek93_at_[hidden]> wrote:
> Here's an example of what might happen if a composed operation doesn't maintain work guards properly:
> https://wandbox.org/permlink/aqsGDNJWTmFd7PdC
>
> Without the work_guard the coroutine never completes. If you add the work_guard, everything works correctly.

If I were to do something stupid like
https://wandbox.org/permlink/sIpX20mQdaHgjESz
- Hide executor_type making it private
- Use the handler executor type for the work guard

What would be the best way to unit test async_foo() to detect the problems?

I guess I could derive from io_context to get the steady_timer to use
an intermediate executor that would forward everything to the
io_context::get_executor but keeping record of the work count, and
bind a similar fake executor to check the dispatch calls. But there
may be a more clever/simpler way?


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