Ketan, For details of wait_event and wait_event_interruptible refer to the following link of online Linux Source Code (linux/sched.h) http://lxr.linux.no/source/include/linux/sched.h?v=2.4.21#L807 Following is the code which wait_event macro replaces 807 #define __wait_event(wq, condition) 808 do { 809 wait_queue_t __wait; 810 init_waitqueue_entry(&__wait, current); 811 812 add_wait_queue(&wq, &__wait); 813 for (;;) { 814 set_current_state(TASK_UNINTERRUPTIBLE); 815 if (condition) 816 break; 817 schedule(); 818 } 819 current->state = TASK_RUNNING; 820 remove_wait_queue(&wq, &__wait); 821 } while (0) See it's an infinite loop till the time the condition passed is not fulfilled. Hope it helps ... Gaurav -----Original Message----- From: Ketan Mukadam [mailto:kmukadam@xxxxxxxxxxxx] Sent: Friday, July 23, 2004 3:07 PM To: Dhiman, Gaurav Subject: RE: wait_event_interruptible() Thanks Dhiman. Ketan At 01:33 PM 7/23/2004, you wrote: >The process which has been put to sleep by wait_event_interruptible() >can be waked up in two cases, if we call wake_up_interruptible >explicitly or process receives any signal when it is sleeping on wait >queue. > >The condition is checked up when the process is waked up, if the >condition fails, the process again goes to sleep, else it will pull it >out itself from wail queue and will perform its action. > >Actually wait_evet_interruptible is a macro which expands to a while >loop for checking that condition in the while loop we make the process >sleep. > >I hope it clears the things !! > >Regards, >Gaurav > > > >-----Original Message----- >From: kernelnewbies-bounce@xxxxxxxxxxxx >[mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Ketan Mukadam >Sent: Friday, July 23, 2004 1:17 PM >To: kernelnewbies@xxxxxxxxxxxx >Subject: wait_event_interruptible() > >Hi !! > >Just a small query, > >When wait_event_interruptible is used, does it needs to be awakened by >the >wake_up_interruptible() call or it comes out of sleep when the condition > >gets true. > >Although LDD talks about it, its example have got me confused, the >example >on pg 150 of scullpipe, it uses the wait_event_interruptible but also >calls >the wake_up_interruptible to wake up readers/writers. > >TIA >Regards >Ketan > > >-- >Kernelnewbies: Help each other learn about the Linux kernel. >Archive: http://mail.nl.linux.org/kernelnewbies/ >FAQ: http://kernelnewbies.org/faq/ > > > >-- >Kernelnewbies: Help each other learn about the Linux kernel. >Archive: http://mail.nl.linux.org/kernelnewbies/ >FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/