Re: Help - how to put a module into sleep for a while?

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

 






interruptible_sleep_on or for that matter any sleep function, is to put the
current process to sleep, not a module. Modules cant be put to sleep, a
delay can be introduced using udelay or mdelay, but this is busy wait, and
for that delay nothing would run, not even your ModB and hence this wont
work. Semaphores cannot be used, as again they are used for mutual
exclusion between processes, down_interruptible puts the process calling it
to sleep, if sem is already taken, so not sure if that can be used in
modules.
So the best solution for you is kernel timers. As konstantyn said, use a
kernel timer, for what ever delay you want.
start_timer for the delay you desire. When it expires, check if your
variable has been set by the other module, if yes do what you want. If not,
start the timer again.

Amit




mohanlal jangir <mohanlal@samsung.com>@nl.linux.org on 06/15/2004 10:30:19
AM

Sent by:    kernelnewbies-bounce@nl.linux.org


To:    l x <whereisit28@yahoo.com>, kernelnewbies@nl.linux.org
cc:

Subject:    Re: Help - how to put a module into sleep for a while?


You can use interruptible_sleep_on or interruptible_sleep_on_timeout
(similar are waking up function). Also have a look at wait_for_completion,
which can call a registered function, once the event has occurred.

Regards
Mohanlal

----- Original Message -----
From: "l x" <whereisit28@yahoo.com>
To: <kernelnewbies@nl.linux.org>
Sent: Monday, June 14, 2004 11:00 PM
Subject: Help - how to put a module into sleep for a while?


> Hi,
>
> I'm working on a module (modB) that works with an
> existing module (modA).
>
> One of modB's functions calls a function,
> func_of_modA(), defined in modA.  If the returned
> value of func_of_modA() is 0, then modB needs to sleep
> (not busy loop) for 1 sencond and then calls
> func_of_modA() again...until the returned value is 1.
>
> What is the best/easiest way to implement this type of
> wait?  Could some one please help me on this?  Sample
> code or code snip would be very helpful.
>
> Thanks,
>
> T.
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




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