Re: how can i make kernel to sleep for 5 minutes?

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

 



On Tue, 2005-01-04 at 06:34 +0000, bunty wrote:
> 
> hello all,
>         I require a schedule_timeout function statement to have kernel
> module sleep for 5 minutes. I require to call a function from kernel
> module from interval of 5 minutes.
>         For that i have written simple kernel module that should print
> string in function and that function be called in a interval of 1
> minute but its printing continually without sleeping.
> 
> regards,
> parag.
>         
> 
> #define MODULE
> #define __KERNEL__

please never ever do those 2 defines inside your module. the buildsystem
will add those automatic, and it gives a big mess if your module ever
goes to the upstream kernel
> {
> reader();
> schedule_timeout(600000);

you have to set the task state like
set_current_state(TASK_UNINTERRUPTIBLE);
before you call schedule_timeout()

but you are far better off just using msleep().
(you are using a 2.6 kernel, right?)


--
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