Boost logo

Boost :

Subject: Re: [boost] [asio] Bug: Handlers execute on the wrong strand.
From: Sorin Fetche (sorin.fetche_at_[hidden])
Date: 2013-10-25 15:26:31


On Tue, Oct 22, 2013 at 4:56 PM, Greg Barron <gregbarron71_at_[hidden]> wrote:

> Hi All,
>
> I would like to refer you to this bug report:
> https://svn.boost.org/trac/boost/ticket/9203
>
>
The way I read the test program attached to the ticket:
https://svn.boost.org/trac/boost/attachment/ticket/9203/main.cpp, there are
only two threads running the continuously posted handlers.
And as one of the two threads is blocked in a handler that never returns, a
handler posted from the other thread will never get to be executed if it
ends up being queued for execution in this blocked thread.

I think this is expected behavior as a strand is not supposed to create a
new thread behind it and a strand is not linked to a specific thread.

It is strange though that, if strands are not being used, the handler
posted from the running thread doesn't get to be queued for execution in
the blocked thread. This although the behavior should be similar as long as
individual operations wrapped in independent strands are equivalent to no
strands at all.

But, as long as AFAIK there is no documented way of controlling the
assignment of handlers and strand-wrapped handlers to running threads, this
is in the end an implementation detail.

Best regards,
Sorin Fetche


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk