Re: [PATCHv2 1/3] eventfd: allow atomic read and waitqueue remove

Michael S. Tsirkin
2010-01-21T17:45:38Z

On Thu, Jan 21, 2010 at 07:47:40PM +0200, Avi Kivity wrote:
> On 01/21/2010 07:32 PM, Michael S. Tsirkin wrote:
>>
>>> Can't you read from the file?
>>>
>> IMO no, the read could block.
>>
>
> But you're in process context. An eventfd never blocks.

Yes it blocks if counter is 0. And we don't know
it's not 0 unless we read :) catch-22.

> --
> Do not meddle in the internals of kernels, for they are subtle and quick to panic.