Unix Programming - Call 'select' on both ends of a named pipe

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2006 > Call 'select' on both ends of a named pipe





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Call 'select' on both ends of a named pipe
patrice.lespagnol@obs-nancay.fr

2006-10-25, 7:15 pm

Hi,
What happens when 2 processes, one reading, the other writing, call
select at the 2 ends of a named pipe to synchronize their data exchange
(while managing other io -> so the use of select) ? Does it work ?

Barry Margolin

2006-10-26, 1:31 am

In article <1161817237.525178.91400@k70g2000cwa.googlegroups.com>,
patrice.lespagnol@obs-nancay.fr wrote:

> Hi,
> What happens when 2 processes, one reading, the other writing, call
> select at the 2 ends of a named pipe to synchronize their data exchange
> (while managing other io -> so the use of select) ? Does it work ?


I don't see why it shouldn't.

If the pipe is currently empty, the reader's select should block, and
the writer's select should return. The writer will then write
something, and then the reader's select will return. If the writer
fills the pipe's buffer and then calls select, it will block until the
reader gets around to reading the data.

This is basically the same as what happens if the processes open the
pipe in blocking mode.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
patrice.lespagnol@obs-nancay.fr

2006-10-26, 1:15 pm


Barry Margolin a =E9crit :

> I don't see why it shouldn't.
>=20


You're right, it works.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com