Re: Multithread select() bug
From: Davide Libenzi (davidel_at_xmailserver.org)
Date: 05/11/04
- Previous message: Christoph Hellwig: "Re: 2.6.6-mm1"
- In reply to: Andre Ben Hamou: "Re: Multithread select() bug"
- Next in thread: Eric Dumazet: "Re: Multithread select() bug"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 10 May 2004 15:09:45 -0700 (PDT) To: Andre Ben Hamou <andre@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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Christoph Hellwig: "Re: 2.6.6-mm1"
- In reply to: Andre Ben Hamou: "Re: Multithread select() bug"
- Next in thread: Eric Dumazet: "Re: Multithread select() bug"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|