From: Robert Hancock <hancockr@shaw.ca>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: questions on wait_event ...
Date: Thu, 22 Dec 2005 18:16:25 -0600 [thread overview]
Message-ID: <43AB41D9.6070600@shaw.ca> (raw)
In-Reply-To: <5mIFB-6PS-33@gated-at.bofh.it>
Alexey Shinkin wrote:
> Hi , all !
> Could anyone please clarify one thing in that old well known
> wait_event_... code (taken from 2.6.5 wait.h ):
>
> #define __wait_event_interruptible(wq, condition, ret) \
> do { \
> wait_queue_t __wait; \
> init_waitqueue_entry(&__wait, current); \
> \
> add_wait_queue(&wq, &__wait); \
> for (;;) { \
> set_current_state(TASK_INTERRUPTIBLE); \
> if (condition) \
> break;
> ........................................
>
> Is it possible that scheduling happen after set_current_state() but before
> checking the condition ?
> If yes - even if we will have condition==TRUE by this moment - the
> scheduler
> will make the process to sleep anyway , right ?
Yes, but since the condition would then have changed after we were put
into the wait queue, they would have woken up the queue and we should be
woken up again.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
next parent reply other threads:[~2005-12-23 0:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5mIFB-6PS-33@gated-at.bofh.it>
2005-12-23 0:16 ` Robert Hancock [this message]
2005-12-23 0:51 ` questions on wait_event Alexey Shinkin
2005-12-23 1:10 ` Steven Rostedt
2005-12-23 1:46 ` Alexey Shinkin
2005-12-23 20:48 ` Steven Rostedt
2005-12-23 0:04 Alexey Shinkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43AB41D9.6070600@shaw.ca \
--to=hancockr@shaw.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox