Re: questions on wait_event ...

From: Steven Rostedt
Date: Thu Dec 22 2005 - 20:10:04 EST


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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/