Current-Users archive

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

Re: select/poll bug?

On 3-Aug-08, at 2:29 PM, Roy Marples wrote:

On Sun, 2008-08-03 at 13:18 -0400, Greg A. Woods; Planix, Inc. wrote:
You still haven't said why you need a timer that can handle in one
setting the span of the entire maximum possible lease time.  Why not
set a regular interval timeout and decrement the elapsed time from the lease TTL every time the timeout happens until finally there's no time
remaining on the lease, perhaps adjusting the interval of the timeout
as the lease nears its expiry time.

It doesn't HAVE to be the max possible lease. It's more effecient to
make one call than lots of small calls, hence the bigger the timeout the
more efficient the program.

dhcpcd currently does what you describe around poll, using INT_MAX as
the upper limit.

I think you're falling for the old "premature optimization" fallacy.

Even if you used 60 seconds as the initial timeout, i.e. with the final timeout being the remainder of the lease time mod 60, then you'd still only be running a VERY few CPU cycles per minute, hardly an annoyance even on a Commodor-64 class machine, never mind anything semi-modern.

                                        Greg A. Woods; Planix, Inc.

Home | Main Index | Thread Index | Old Index