On Fri, Jun 21, 2019 at 5:22 PM Jasper Siepkes <[email protected]> wrote:
>
> Hi!
>
> I'm a bit confused about how libevent looks at EAGAIN. From what I can tell 
> is that some event base implementations deal with EAGAIN themselves and will 
> never return EAGAIN as an error. However other backends do seem to return 
> EAGAIN as an error. The "A low-level ROT13 server with Libevent" example on 
> http://www.wangafu.net/~nickm/libevent-book/01_intro.html seems to take into 
> account libevent could return EAGAIN but from what I can tell that 
> documentation might be a bit dated?
>
> Should I as a developer always consider that EAGAIN might be returned? Or 
> should it never be returned by libevent and be handled in the event base?

Hi!

libevent allows you to avoid busy polling (via epoll/poll/select/...)

That example uses only event (without bufferevent), and with this you
still need to call read(2) by yourself, and of course it can return
EAGAIN.

But if you use bufferevent, you do not need to call read() manually
since they contains two buffers: input and output, that you can use
instead of plain read(2)/write(2).

Hope this helps,
Azat.
***********************************************************************
To unsubscribe, send an e-mail to [email protected] with
unsubscribe libevent-users    in the body.

Reply via email to