epoll (was Re: [PATCH] async poll for 2.5)

From: John Myers (jgmyers@netscape.com)
Date: Thu Oct 17 2002 - 12:43:56 EST


Dan Kegel wrote:

> As long as we agree that the kernel may provide spurious readiness
> notifications on occasion, I agree.

Great! We agree! Progress!

>>> while (read() == EAGAIN)
>>> wait(POLLIN);
>>>
>> Assuming registration of interest is inside wait(), this has a race.
>> If the file becomes readable between the time that read() returns and
>> the time that wait() can register interest, the connection will hang.
>
>
> Shouldn't the should be rearmed inside read() when it returns EAGAIN?

The key phrase is "assuming registration of interest is inside wait()."
 The code fragment didn't cover when registration of interest occurs.
 If registration of interest occurs before the read() or if registration
of interest while the fd is ready generates an event, there is no race.
 If registration of interest occurs after the read() and registration of
interest while the fd is ready does not generate an event, there is a race.



-
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/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:36 EST