Re: [PATCH] async poll for 2.5

From: Dan Kegel (dank@kegel.com)
Date: Wed Oct 16 2002 - 15:03:04 EST


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/



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