[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: preventing pipe reader from existing on writer exiting
From:       John Reiser <jreiser () bitwagon ! com>
Date:       2009-09-30 22:26:13
Message-ID: 4AC3DB05.3030905 () bitwagon ! com
[Download RAW message or body]

> Ultimately I need to do I/O through a named pipe and I
> need to be able to restart the writer without restarting the reader.

The reader of a fifo will not be terminated as long as there is
at least one writer to the fifo.  Therefore, create a second writer.
For example, to hold the fifo open for one hour:

      sleep 3600  > /tmp/fifo  &

The shell forks, then opens /tmp/fifo for writing.  The open() waits
until there is a reader.  Then the forked shell execs /bin/sleep,
which waits for 3600 seconds before exiting.  During that 3600
seconds the fifo is open for writing, so the system will not
terminate any reader of the fifo for at least that long.

-- 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic