public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Alexey Shinkin <alexshinkin@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: questions on wait_event ...
Date: Thu, 22 Dec 2005 20:10:40 -0500	[thread overview]
Message-ID: <1135300240.12761.27.camel@localhost.localdomain> (raw)
In-Reply-To: <BAY16-F8E0161EA0C4B79180F698AF330@phx.gbl>

On Fri, 2005-12-23 at 06:51 +0600, Alexey Shinkin wrote:

> 
> And what if the condition have changed after we have checked it in 
> wait_event() but
> before calling __wait_event() and before putting the process into the wait 
> queue ?
> The process could not be woken up "in advance" , right ?

Lets add the other part of this too (the __wait_event)

#define __wait_event(wq, condition) 					\
do {									\
	DEFINE_WAIT(__wait);						\
									\
	for (;;) {							\
		prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE);	\
		if (condition)						\
			break;						\
		schedule();						\
	}								\
	finish_wait(&wq, &__wait);					\
} while (0)


> 
> 
> #define wait_event(wq, condition)        \
> do {                                                   \
>         if (condition)                                \
>                 break;                                 \
>    /* and here we have condition changed  ???? */
>         __wait_event(wq, condition);        \
> } while (0)
> 

So if the condition happens there, it will be checked again up above in
__wait_event.

-- Steve



  reply	other threads:[~2005-12-23  1:10 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 ` questions on wait_event Robert Hancock
2005-12-23  0:51   ` Alexey Shinkin
2005-12-23  1:10     ` Steven Rostedt [this message]
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=1135300240.12761.27.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=alexshinkin@hotmail.com \
    --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