Walt Mankowski on Sun, 19 Nov 2000 23:18:04 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Re: dynamic file (script output)


On Sun, Nov 19, 2000 at 10:51:28PM -0500, MaD dUCK wrote:
> also sprach Kevin Falcone (on Sun, 19 Nov 2000 10:03:58PM -0500):
> > It constantly feeds sigs into the FIFO, and unless you write email at
> > an incredible rate (about 2 per second) you're not going to have a dry
> > FIFO.  
> 
> but would i then not be filling up the FIFO to the point of no
> return??? how is a FIFO stored? in memory?

It's not a problem because the data never builds up.  See the
explanation below.

> it would be nice to have a FIFO that could act as a "packet buffer" of
> length 1, where i define a packet to be something like the output from
> one invocation. sort of like a super market shelf with capacity one:
> customer service puts product in, then only as soon as customer
> removes the product, a new one is placed in.

In a sense that's how sigrand works.  Its main loop looks like this:

loop forever
  open fifo
  print random fortune to fifo
  close fifo
end loop

The close blocks until somebody (e.g. your mailer) comes along and
reads the fifo.

You can confirm this behavior with a simple experiment.  First, create
a fifo:

mkfifo foo

Now open two shell windows.  In the first, enter

cat >foo

Type some random text.  When you're finished, enter Ctrl-D to signal
end of file.  The window should just hang, and you won't return to the
shell prompt.

Now in the other window, enter

cat foo

You'll see the text you entered in the first window, and then both
windows should return to the shell prompt.

Walt

Attachment: pgpHMqRC4DiiB.pgp
Description: PGP signature