Re: timer problem

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

 



On Thu, Jul 7, 2011 at 12:19 PM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> Hi..
>
> Trying to add another perspective, feel free to take or not  :)
>
> On Wed, Jul 6, 2011 at 23:52, Prashant Shah <pshah.mumbai@xxxxxxxxx> wrote:
>>
>> void timfunc(unsigned long data)
>> {
>>        printk("hi this is a timer %lu\n", data);
>>        set_current_state(TASK_INTERRUPTIBLE);
>>        schedule_timeout(10 * HZ);
>>        printk("hi again this is a timer after timeout %lu\n", data);
>> }
>>
>> 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;
>> }
>
> If my brain still works correctly, then I think the core of the
> problem is that you're doing schedule() inside timer function. The
> thing is, timer function is running in bottom halves...or in other
> word, you are not supposed to do that in interrupt-handler alike
> function.
>
> What you need to do in order to wake up ten minutes later (10*HZ) is

10*HZ is for 10 mins or for 10 seconds?

> to reinsert the function and make it expire 10*HZ later.
>
> Just my 2 cents :)
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

_______________________________________________
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