bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] poll: wait until timeout on pipes (win32)


From: Edward Thomson
Subject: Re: [PATCH] poll: wait until timeout on pipes (win32)
Date: Thu, 11 Sep 2014 17:22:15 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Sep 11, 2014 at 07:51:59PM +0300, Eli Zaretskii wrote:
> Maybe if you import the select module from gnulib, in addition to
> poll, the problem will be solved?

I don't know.  My understanding was that gnulib would not try to
replace existing functions.

Is there a way to build the gnulib tests such that poll will call
gnulib's select?

> What happens if GetTickCount returns a small value, after the
> wraparound, while 'start' has a large value before the wraparound?
> Subtracting the latter from the former will give a very large positive
> value, right?

It will return the difference:

"A computation involving unsigned operands can never overflow, because a
result that cannot be represented by the resulting unsigned integer type
is reduced modulo the number that is one greater than the largest value
that can be represented by the resulting type".  (Section 6.2.5)

For example, if start is 4294967294 and end is 0, then end - start is
-4294967294.  Modulo UINT_MAX+1 is 2, which is the correct elapsed time.

Thanks-
-ed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]