Re: bugreport: poll() timeout always takes 10ms too long

Tachino Nobuhiro (tachino@open.nm.fujitsu.co.jp)
Fri, 22 Jun 2001 13:24:50 +0900


Hello,

At Fri, 22 Jun 2001 11:52:12 +1000,
raf@raf.org wrote:
>
> [1.] One line summary of the problem:
>
> poll() timeout always takes 10ms too long
>
> [2.] Full description of the problem/report:
>
> Select() timeouts work fine. A timeout between 10n-9 and 10n ms times
> out after 10n ms on average. Poll() timeouts between 10n-9 and 10n ms,
> on the other hand, time out after 10(n+1) ms on average. It's always a
> jiffy too long. This means it's impossible to set a 10ms timeout using
> poll() even though it's possible using select(). The programs and their
> output below [6] demonstrate this. The same behavious occurs with
> linux-2.2 and linux-2.4.

I think this is correct behavior. The Single UNIX Specification
describes about the timeout parameter of poll() as follows,

If none of the defined events have occurred on any selected
file descriptor, poll() waits at least timeout milliseconds
for an event to occur on any of the selected file descriptors.

On the other hand, select(),

If the specified condition is false for all of the specified
file descriptors, select() blocks, up to the specified timeout
interval, until the specified condition is true for at least
one of the specified file descriptors.
-
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/