so, this is what i got from your mail all same module functions read() { calls wait_event_interruptible. /*here the input buffer we need some data on is nothing but a char array in the module, on which some data is written by other functions within the module */ } func_2{ /*this writes on that char buffer, which was empty and because of which the current process was put to sleep in read() */ so now this shld do this; 1. fill the char buffer 2. wake_up_interruptible } right ? thanks Amit Jan Hudec <bulb@ucw.cz>@nl.linux.org on 06/10/2004 03:26:54 AM Sent by: kernelnewbies-bounce@nl.linux.org To: Amit Kumar Singh/HSS@HSS cc: Kernel Newbies <kernelnewbies@nl.linux.org> Subject: Re: wait_event_interruptible and wake_up_interruptible On Wed, Jun 09, 2004 at 19:03:26 +0530, aksingh@hss.hns.com wrote: > Once I call wait_event_interruptible, is it important to call > wake_up_interruptible sometime later. wait_even_interruptible would > automatically awaken the sleeping process when the condition it takes as an > argument evaluates to TRUE, so in which specific cases do we require a > separate wake_up_interruptible. ? No, wait_event(_interruptible) will NOT automatically awaken anything, because when a process is sleeping, it does not get any CPU time, not even enough CPU time to check the condition. The process that changes something so the condition might possibly come true must also call wake_up so the sleeping process will wake up and check whether the condition is true (and go to sleep again, if it is not). Now one more thing to notice is, that _interruptible on wake_up and interruptible on wait_event/sleep_on are not exactly the same thing. _interruptible on wait_event/sleep_on means, that the process will also wake up if it got a signal. But IIRC on wake_up, it means to only wake up such processes. So you can, and shoud, always use wake_up when you make the wait condition true. You should use wake_up_interruptible if you neet the process to wake up for other reason (so processes that can't handle that other reason, eg. signal, won't wake up). ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Binary data