Re: timer problem

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

 



Hello Prashant,

> struct timer_list tim;
>
> void timfunc(unsigned long data)
> {
[..]
>        schedule_timeout(10 * HZ);
[..]
> }
>
> static int __init init_testmod(void)
> {
>        init_timer(&tim);
>        tim.expires = jiffies + HZ*5;
>        tim.data = 1000;
>        tim.function = timfunc;
>        add_timer(&tim);
>        return 0;
> }

You can find here ([1]) a good source for documenting
on kernel timers API.

Basically, the kernel has a list with registered timers and
runs the associated handlers when timeout expires.

Looking at your code, you've initialized the timer but you didn't
added it to kernel timers list.

You can find here a simple example of how to setup a timer ([2]).

Please read this [3], and figure out why even after you'll correctly
setup the timer, your timer handler will cause you trouble.

thanks,
Daniel.


[1] http://www.ibm.com/developerworks/linux/library/l-timers-list/index.html
[2] http://lxr.linux.no/linux+v2.6.39/arch/blackfin/kernel/nmi.c#L176
[3] http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/c557.html

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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