1fifo(n)                                                                fifo(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       fifo - Create and manipulate u-turn fifo channels
9

SYNOPSIS

11       package require Tcl
12
13       package require memchan
14
15       fifo
16
17______________________________________________________________________________
18

DESCRIPTION

20       fifo   creates a stream-oriented in-memory channel and returns its han‐
21              dle. There is no restriction on the ultimate size of  the  chan‐
22              nel,  it will always grow as much as is necessary to accommodate
23              the data written into it.
24
25              In contrast to the channels generated by memchan a channel  cre‐
26              ated  here  effectively  represents  an U-turn. All data written
27              into it can be read out, but only in the same order.  This  also
28              means that a fifo channel is not seekable.
29
30              The  channels  created  here  can  be transferred between inter‐
31              preters in the same thread and between threads, but  only  as  a
32              whole.  It is not possible to use them to create a bi- or unidi‐
33              rectional connection between two interpreters.
34
35       Memory channels created by fifo provide two read-only options which can
36       be queried via the standard fconfigure command. These are
37
38       -length
39              The value of this option is the number of bytes currently stored
40              in the queried memory channel.
41
42       -allocated
43              The value of this option is the number of bytes currently  allo‐
44              cated  by the queried memory channel. This number is at least as
45              big as the value of -length.
46
47       As the channels generated by fifo grow as  necessary  they  are  always
48       writable.  This  means that a writable fileevent-handler will fire con‐
49       tinuously.
50
51       The channels are also readable if they contain more  than  zero  bytes.
52       Under  this  conditions a readable fileevent-handler will fire continu‐
53       ously.
54

NOTES

56       One possible application of memory channels created by memchan or  fifo
57       is as temporary storage device to collect data coming in over a pipe or
58       a socket. If part of the processing of the incoming data is to read and
59       process  header  bytes or similar fifo are easier to use as they do not
60       require seeking back and forth to switch between  the  assimilation  of
61       headers at the beginning and writing new data at the end.
62

SEE ALSO

64       fifo2, memchan, null
65

KEYWORDS

67       channel, fifo, i/o, in-memory channel, memchan, stream
68
70       Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
71
72
73
74
75Memory channels                       2.1                              fifo(n)
Impressum