From: Michael Noisternig <mnoist@cosy.sbg.ac.at>
To: linux-kernel@vger.kernel.org
Subject: (e)poll and (rd)hup questions
Date: Tue, 26 Aug 2008 19:25:22 +0200 [thread overview]
Message-ID: <48B43C82.8060109@cosy.sbg.ac.at> (raw)
Hello folks,
I hope this is a right place to ask this question. (Sorry if it isn't,
please hint me where to post in that case.)
This has been bugging me for quite some while now. I'm using epoll in
default level-triggered mode. I'm polling for input, output, rdhup, and
forcibly for hup. I figured that when I get EPOLLRDHUP that doesn't mean
there is no more data to read, presumably I must empty the kernel buffer
by continously reading from the fd until I get zero as a result
indicating rdhup. This means EPOLLRDHUP is delivered asynchronously and
thus is pretty useless to me.
On the other hand, EPOLLHUP seems to be delivered synchronously. If it
isn't then this means I get constantly notified about a closed fd until
I have read all data from the kernel buffer and remove the fd from the
epoll set (which makes being forced to hup notifications useless to me).
(And no, don't tell me to use edge-triggered mode, I have reasons to use
level-triggered.)
Question: Is my observation correct that EPOLLRDHUP is delivered
asynchronously in contrast to EPOLLHUP? Or is EPOLLHUP delivered
asynchronously as well?
Thanks, anwers would help a lot!!!
Michael
next reply other threads:[~2008-08-26 17:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-26 17:25 Michael Noisternig [this message]
2008-08-26 19:11 ` Davide Libenzi
2008-08-26 19:37 ` Michael Noisternig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48B43C82.8060109@cosy.sbg.ac.at \
--to=mnoist@cosy.sbg.ac.at \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®