Re: wait_event_interruptible and wake_up_interruptible

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

 



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: Digital signature


[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