kernel timers

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

 



Hi,
   In my kernel module, I need to invoke a function repeatly but at
different intervals. I tested two ways, one is add_timer()/del_timer()
every time, the other is add_timer() once and only mod_timer() when
needed. The first problem is that mod_timer() seems not work, my code is
like this:

add_timer(&timer);
mod_timer(&timer, big-enough);    // disable timer right now

// when I need to invoke my routine after certain interval
mod_timer(&timer, jiffies + interval_1);
   .
   .
   . // disable the timer in my routine by mod_timer(&timer, big-enough)
   .
// when I need to invoke my routine again for a different interval
mod_timer(&timer, jiffies + interval_2);

Any comment is highly appreciated!

One more thing, jiffies is 10ms resolution, can I have a ms resolution
timer in the kernel? Any other alternatives can I use?

Thank you very much for your help,

Best,

-Haijin

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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