Re: [PATCH] async poll for 2.5

Dan Kegel (dank@kegel.com)
Wed, 16 Oct 2002 13:03:04 -0700


John Gardiner Myers wrote:
>> 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?
That's how I do it in my wrapper library these days.
No reason to have a race.

- Dan

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