From: Ulrich Drepper <drepper@gmail.com>
To: Brent Casavant <bcasavan@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Pollable Semaphores
Date: Fri, 21 Jan 2005 19:43:05 -0800 [thread overview]
Message-ID: <a36005b5050121194377026f39@mail.gmail.com> (raw)
In-Reply-To: <Pine.SGI.4.61.0501211647100.7393@kzerza.americas.sgi.com>
On Fri, 21 Jan 2005 17:17:51 -0600, Brent Casavant <bcasavan@sgi.com> wrote:
> 2. select/poll on the fd return EWOULDBLOCK if the current value of
> the futex is not equal to the value of interest. Otherwise it
> behaves as FUTEX_FD currently does.
This is the problematic part. The expected value, as you suggested,
can be handled with a write() and since the expected value is often
constant, this is a low-overhead method.
But the poll() interface is not so easy. You cannot change the poll()
semantic to return such an error. It makes really no sense.
What I thought could be done is to define instead a new POLL* constant
which signals the EWOULDBLOCK condition of the futex() syscall in the
revents member. The poll/epoll syscall would do it's normal work and
just fill all the appropriate revents. A futex value mismatch would
mean the call is not blocking at all, just as available data would be
for POLLIN.
For select, I would use the exception bitmap. The bit is set for
futex fds in the EWOULDBLOCK case.
All this _could_ work. But we've been bitten quite a few times in the
past. There might be special cases which may need at least some
additional functionality. This should be taken into account in the
original design.
So, if people are interested in this, code something up and try it.
Stress it as much as you can. I would oppose adding any new futex
interface created at a hunch if I'd be Andrew.
And is another thing to consider. There is at least one other event
which should be pollable: process (maybe threads) deaths. I was
hoping that we get support for this, perhaps in the form of polling
the /proc/PID directory. For poll(), a POLLERR value could mean the
process/thread died. For select(), once again a bit in the except
array could be set.
next prev parent reply other threads:[~2005-01-22 3:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-21 21:22 Pollable Semaphores Brandon Corey
2005-01-21 21:37 ` Roland Dreier
2005-01-21 23:17 ` Brent Casavant
2005-01-22 3:43 ` Ulrich Drepper [this message]
2005-01-22 5:52 ` Chris Wright
2005-01-22 7:05 ` Chris Wright
2005-01-22 7:39 ` Ulrich Drepper
2005-01-22 18:02 ` Chris Wright
2005-01-24 20:42 ` Robert White
2005-01-22 0:07 ` Davide Libenzi
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=a36005b5050121194377026f39@mail.gmail.com \
--to=drepper@gmail.com \
--cc=bcasavan@sgi.com \
--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