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:45 AM, Roy Marples wrote:

On Sat, 2008-08-02 at 22:07 -0400, Greg A. Woods; Planix, Inc. wrote:
I'm not sure why you want to set a timer for the whole lease.

Why not set a regular timer and decrement the remaining lease TTL on
that interval?

The extra CPU cycles through such a loop, even counting all the kernel
time for the system call transitions, is inevitably negligible over
such periods as DAYS.

For the duration of the lease we need to monitor a signal pipe and the
fd for link carrier messages. As select,poll and friends have timeouts
it makes sense to use them instead of calls like setitimer.

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.

                                        Greg A. Woods; Planix, Inc.

Home | Main Index | Thread Index | Old Index