mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* pipe_wait illustration needed
@ 2005-01-11 10:49 selvakumar nagendran
  2005-01-12  1:59 ` Robert White
  0 siblings, 1 reply; 4+ messages in thread
From: selvakumar nagendran @ 2005-01-11 10:49 UTC (permalink / raw)
  To: linux-kernel

Hello linux-experts,
    I can't understand this function pipe_wait defined
in linux/fs/pipe.c line by line,especially the lines
after add_wait_queue. If the process is added to the
wait queue and schedule() is called then after that a
new process will be selected and will be given the
CPU. So, the current process will be out of the way.
Then, how can the kernel reach the line 
remove_wait_queue. 
    Also, how the scheduler will know that the pipe
event has occurred and it's safe to set the process
state to TASK_RUNNING?

Thanks,
selva
----------------
/* Drop the inode semaphore and wait for a pipe event,
atomically */
void pipe_wait(struct inode * inode)
{
	DECLARE_WAITQUEUE(wait, current);
	current->state = TASK_INTERRUPTIBLE;
	add_wait_queue(PIPE_WAIT(*inode), &wait);
	up(PIPE_SEM(*inode));
	schedule();
	remove_wait_queue(PIPE_WAIT(*inode), &wait);
	current->state = TASK_RUNNING;
	down(PIPE_SEM(*inode));
}


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-12 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-11 10:49 pipe_wait illustration needed selvakumar nagendran
2005-01-12  1:59 ` Robert White
2005-01-12  4:42   ` selvakumar nagendran
2005-01-12 20:39     ` Robert White

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®