Boost logo

Boost :

Subject: Re: [boost] [ASIO] Issue with epoll reactor? Callback handler not executed.
From: Arpan Sen (arpansen_at_[hidden])
Date: 2013-05-29 14:27:14


Thanks Brad. This is likely what is happening since 2 consecutive calls to
io_service.run_one fixed the problem. Note that a single call to
io_service.run did NOT fix the problem.

I do have follow up questions here:

   1. What are internal handlers?
   2. Where in boost documentation do we mention internal handlers?
   3. Is this internal handler business new to boost asio? The 1.44 version
   always calls my handler after the call to run_one. If yes, since which
   version has this been around?
   4. In async-read-until my handler will only get called after the 2nd
   call to io_service.run_one. Are there any indications after
   io_service.run_one the first time that I need to call the method a second
   time?
   5. What's a clean way to do async-read-until? Calling run_one twice
   looks genuinely messy.
   6. Why does the single call to io_service.run not fix the problem? It
   too returns 1.

Many thanks for all the help here people. Appreciate it.

Arpan

On Sat, May 25, 2013 at 6:38 PM, Brad Higgins <bhiggins_at_[hidden]> wrote:

> Hi Arpan,
> Read Marat's response again. The likely issue here is not epoll or
> asio, but rather with your code trying to use composed operations like
> async_write() and async_read_until() with io_service.run_one().
>
> >
> > 4. Marat's code is using io_service.run - why should I not be using
> > run_one?
>
> run_one() will run until the io_service is stopped (and return 0), or
> until at most 1 completion handler is called (and return 1). As Marat
> notes, async_read_until() is a composed operation - it may result in
> multiple async_read_some() operations internally, each with their own
> completion handler. Since you use run_one(), you haven't allowed
> async_read_until() to complete in cases in which it needs to call multiple
> internal handlers.
>
> >
> > Any thoughts on debugging or setting epoll options from asio interface to
> > see what is going on?
>
> Use io_service.run(). You can check its return value to see how many
> handlers it called.
>
> Thanks,
> Brad
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Regards,
   Arpan
-----------------------------------------------------------------------------------------------------------------
Reality is merely an illusion, albeit a very persistent one.

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