From: Davide Libenzi <davidel@xmailserver.org>
To: Andre Ben Hamou <andre@bluetheta.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Multithread select() bug
Date: Mon, 10 May 2004 15:09:45 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0405101457340.1156@bigblue.dev.mdolabs.com> (raw)
In-Reply-To: <409FFAA0.4000301@bluetheta.com>
On Mon, 10 May 2004, Andre Ben Hamou wrote:
> Davide Libenzi wrote:
> > Try:
> >
> > select (socket + 1, &fds, &fds, &fds, &timeout);
> > ^^^^^
>
> That does work, but only as a workaround (and not a universally
> applicable one). Select *should* return upon the closure of either end
> of a socket connection that is in the read-FD-set only (unless I've
> completely misunderstood the various references).
The standard says that select should return when the operation against the
fd would not block *or* would return an error different from
would-have-blocked. The following operation on a closed fd would be an
EBADF, that fits the standard description. OTOH, MT is messy. Consider a
thread that closes the fd and immediately after open another one having
the same fd#. Bottom line is, don't do it.
- Davide
next prev parent reply other threads:[~2004-05-10 22:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 21:26 Andre Ben Hamou
2004-05-10 21:47 ` Davide Libenzi
2004-05-10 21:56 ` Andre Ben Hamou
2004-05-10 22:09 ` Davide Libenzi [this message]
2004-05-10 21:57 ` Eric Dumazet
2004-05-10 22:11 ` Andre Ben Hamou
2004-05-10 22:31 ` Eric Dumazet
2004-05-10 23:01 ` Andre Ben Hamou
2004-05-11 6:07 ` Armin Schindler
2004-05-11 6:24 ` Eric Dumazet
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=Pine.LNX.4.58.0405101457340.1156@bigblue.dev.mdolabs.com \
--to=davidel@xmailserver.org \
--cc=andre@bluetheta.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
all inboxes | Powered by JetHome®