<< Dot-Replacement
>> Shellpipe

The PIPE: queue-handler

In the AmigaOS release 2.04, a new handler for passing data between programs was introduced. This handler is called `L:Queue-Handler', better known as the `PIPE:' device.

`PIPE:' implements a true pipe familiar from UNIX systems. Its function is to pass the output of one program to another program as input. You can chain several programs together using multiple pipes.

The advantages of using pipes are:

  1. No need for a lot of RAM to keep the temporary files, or, no need to slow things down by storing temporary files on the HD.
  2. Faster operation since the intermediate data doesn't need to be stored anywhere between programs.

The `PIPE:' device differs from the UNIX pipes in two important respects:

  1. It is a device, so the input and output of the programs doesn't need to be a redirected standard output, although that is the general case. You can also use `PIPE:' instead of files, with two restrictions; you can not read a directory from `PIPE:', and the `PIPE:' `file' can not be `seeked' in.
  2. It does not support a flush operation. If all of the data written in a `PIPE:' device is not read out, it will stay there, buffered. Thus you must always `empty' a pipe before closing it.
  3. Because of the above, if unread data exceeds the size of the `PIPE:' internal buffer, the program writing to the pipe will `block' (that is, suspend operation) until the data is read. See below on how to manually flush a pipe.

The PIPE: handler name syntax is `PIPE:name/bufsize/bufnum', where `name' is the name for the pipe channel. Using names you can have several simultaneous pipe operations. The optional arguments bufsizeand bufnum specify the size and number of the buffers used by `PIPE:'. Normally, you would just use `PIPE:name'.

The default buffer size of `PIPE:' is 4096 bytes, and the number of buffers (ie. channels) is unlimited.

Osma Ahvenlampi (Osma.Ahvenlampi@hut.fi)



<< Dot-Replacement >> Shellpipe