basic and stupid question on wait_event and wake_up

Ming Liu eemingliu at
Mon Aug 13 18:33:39 EST 2007

Dear Domen,
Thanks for your reply first. 

>I understand it this way:
>- condition
>   Just checking the condition is one way (if you don't have a wake_up
>   source, like an interrupt), but that's not really what wait_event does.
>   It would be something like
>	while (condition) {
>		msleep(10);
>	}
>   There was some talk on poll_wait(), but I don't know what happened to
>   it.

So you mean in my senario (wake the process up in the interrupt handler), I 
needn't to use wake_up at all? A "condition == true" in the interrupt 
handler is enough to wake the sleeping process up? Am I right?

I checked the source code in linux/wait.h and here is the defination of 

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

#define wait_event(wq, condition) 					
do {								
	if (condition)	 					
	__wait_event(wq, condition);				
} while (0)

More information about the Linuxppc-embedded mailing list