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

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

 



Use kernel timers: linux/timer.h

Konstantyn



-----Original Message-----
From: l x [mailto:whereisit28@yahoo.com]
Sent: Monday, June 14, 2004 3:07 PM
To: prasanna wakhare
Cc: kernelnewbies@nl.linux.org
Subject: Re: Help - how to put a module into sleep for a while?


Thanks for the info.

The reason I do this is that modB should do something
only after modA is ready (completes some tasks).  So
to check if modA is ready, I put a flag (int my_flag)
in modA.  modA sets my_flag to 1 after it completes
the tasks.  modB checks my_flag by calling
func_of_modA()defined in modA every 1 second.

If I can not put modB in sleep, what is the easiest
way to do this?

Thanks,

T.


--- prasanna wakhare <prasannawakhare@yahoo.com>
wrote:
> hi,
> module wont sleep at all.You are putting down kernel
> to sleep! In device driver also the process which
> calls modules read/write function sleeps 
> as one can sleep in process context,but this is
> process not module.
> i think you try it and definately yr system will
> halt.
> i have'n't tried it,the reason is simple you better
> think . Rather why you need to do this,such things 
>  i had never seen,if the module can sleep would be
> true?
> then i really want to know the thoery behind it.
> Prasanna
> --- l x <whereisit28@yahoo.com> wrote:
> > 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/
> > 
> > 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 



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


[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