Re: name pipe problem, quick question
From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: Fri, 11 Jun 2004 15:06:44 -0400
-----BEGIN PGP SIGNED MESSAGE-----
> "Richard Tobin" <email@example.com> wrote in message
>>In article <2itvdsFqt04iU1@uni-berlin.de>,
>>187 <firstname.lastname@example.org> wrote:
>>>>>echo "" > $b/cmd-1&
>>>>your script stops here, waiting for something to open $b/cmd-1 for
>>>How can I fix the problem? Any suggestions?
>>Don't write to the named pipes until the program is listening on them.
> I'm not entirely sure what I'm doing (I've never worked with named pipes
> before), could you please elaborate a little? What do you mean exactly?
Unless the programs handle named pipes with special settings
(O_NONBLOCK, IIRC), you get blocking behaviour by default.
A named pipe can have multiple writers, but only one reader. Any process
that opens the pipe for writing blocks until the pipe has also been
opened for reading. Any process that opens the pipe for reading blocks
on the first read until the pipe has been opened for writing.
The only way around this is to open the pipe in non-blocking mode, and
you can't do this in a script.
Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
-----END PGP SIGNATURE-----