2002-10-16 23:25:37

by John Myers

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

Davide Libenzi wrote:

>I told you did not understand the API, this code won't work for edge
>triggered APIs.
>
Nonsense. If you wish to make such a claim, you need to provide an
example of a situation in which it won't work.



Attachments:
smime.p7s (3.45 kB)
S/MIME Cryptographic Signature

2002-10-16 23:37:32

by Davide Libenzi

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

On Wed, 16 Oct 2002, John Gardiner Myers wrote:

> Davide Libenzi wrote:
>
> >I told you did not understand the API, this code won't work for edge
> >triggered APIs.
> >
> Nonsense. If you wish to make such a claim, you need to provide an
> example of a situation in which it won't work.

Your welcome. This is your code :

for (;;) {
fd = event_wait(...);
while (do_io(fd) != EAGAIN);
}

If the I/O space is not exhausted when you call event_wait(...); you'll
never receive the event because you'll be waiting a 0->1 transaction
without bringing the signal to 0 ( I/O space exhausted ). That one is a
typical use of poll() - select() - /dev/poll and you showed pretty clearly
that you do not seem to understand edge triggered event APIs. If you code
your I/O function like :

int my_io(...) {

if (event_wait(...))
do_io(...);

}

and you consume only part of the I/O space with the first call to my_io(),
the second call will block _infinitely_.



- Davide