weird way to reset a timer

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

 



  from drivers/isdn/mISDN/l1oip_core.c (line 289):

/* restart timer */
        if ((int)(hc->keep_tl.expires-jiffies) < 5*HZ) {
                del_timer(&hc->keep_tl);
                hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE*HZ;
                add_timer(&hc->keep_tl);
        } else
                hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE*HZ;


  huh?  in the first place, whenever i see a combination of
del_timer()/change value/add_timer(), i normally assume that can be
replaced with a single call to mod_timer().

  i don't understand the else clause -- i wasn't aware that you could
simply change the expires value of a timer and have that mean
anything.  can someone clue me in on what's happening there?  thanks.

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux