lkml.org 
[lkml]   [2002]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectepoll (was Re: [PATCH] async poll for 2.5)
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.

[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.109 / U:2.312 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site