Re: libev featured fifo

2016-05-17 Thread Marc Lehmann
On Wed, May 18, 2016 at 02:29:14AM +0200, Robert Eisele  wrote:
> directly accepting 0 byte reads after the first byte was read. Is this a
> problem with libev or am I missing something?

That's likely a problem with your code forgetting to close the fifo?

> epoll_wait(3, {{EPOLLHUP, {u32=5, u64=4294967301}}}, 64, 59743) = 1
> epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN, {u32=5, u64=4294967301}}) = 0
> clock_gettime(CLOCK_MONOTONIC, {43720, 29238758}) = 0
> read(5, "", 130)= 0
> 
> I'd like to put the process asleep again when everything was read. Is
> there a way to accomplish that?

Unregister the I/O watcher, close the socket.

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

libev featured fifo

2016-05-17 Thread Robert Eisele
Hi,

I wanted to create a simple non-blocking fifo using libev. It works
great, but when I strace the process, I see a lot of epoll_waits
directly accepting 0 byte reads after the first byte was read. Is this a
problem with libev or am I missing something?

In more detail, the code can be found here: http://pastebin.com/2NUTkPNb

And what I see on strace is this occuring a lot:

epoll_wait(3, {{EPOLLHUP, {u32=5, u64=4294967301}}}, 64, 59743) = 1
epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN, {u32=5, u64=4294967301}}) = 0
clock_gettime(CLOCK_MONOTONIC, {43720, 29238758}) = 0
read(5, "", 130)= 0

I'd like to put the process asleep again when everything was read. Is
there a way to accomplish that?

Thanks!

Robert



___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev