Hello, Please take a look at the attached code. Shouldn't poll() get a POLLHUP event when the child process exits, closing the write end of the pipe? Thanks, Vlad -------------- next part -------------- A non-text attachment was scrubbed... Name: poll.cpp Type: application/octet-stream Size: 1737 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20090603/3d24343e/poll.obj
Hm, according to the code at http://www.greenend.org.uk/rjk/2001/06/poll.html, it seems to work as expected (returning both POLLIN and POLLHUP), when closing the write end of the pipe from within the same process. On Wed, Jun 3, 2009 at 3:15 PM, Vlad Galu <dudu@dudu.ro> wrote:> Hello, > > Please take a look at the attached code. Shouldn't poll() get a > POLLHUP event when the child process exits, closing the write end of > the pipe? > > Thanks, > Vlad >
On Wed, Jun 03, 2009 at 03:15:32PM +0300, Vlad Galu wrote:> Hello, > > Please take a look at the attached code. Shouldn't poll() get a > POLLHUP event when the child process exits, closing the write end of > the pipe?It seems that you code forgot to close the write end of the pipe in parent. Thus, pipe is referenced by another file descriptor from the parent process, and you do not get close event. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20090603/d6f14751/attachment.pgp