Re: questions on wait_event ...

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux