1fifo2(n) fifo2(n)
2
3
4
5______________________________________________________________________________
6
8 fifo2 - Create and manipulate pipe fifo channels
9
11 package require Tcl
12
13 package require memchan
14
15 fifo2
16
17______________________________________________________________________________
18
20 The command described here is only available in a not-yet released ver‐
21 sion of the package. Use the CVS to get the sources.
22
23 fifo2 creates two stream-oriented in-memory channels and returns their
24 handles as a two-element list. There is no restriction on the
25 ultimate size of the channels, they will always grow as much as
26 is necessary to accommodate the data written into them.
27
28 In contrast to the channels generated by fifo a pair of channels
29 created here is connected internally in such a way that data
30 written into one channel can be read from the other. All data
31 written into them is read in the same order. This also means
32 that the two channels of the pair are not seekable.
33
34 The channels created here can be transferred between inter‐
35 preters in the same thread and between threads. As both channels
36 in the pair can be transferred independently they can be used to
37 create a bidirectional connection between two interpreters.
38
39 Memory channels created by fifo2 provide two read-only options which
40 can be queried via the standard fconfigure command. These are
41
42 -rlength
43 The value of this option is the number of bytes currently avail‐
44 able for reading from the channel.
45
46 -wlength
47 The value of this option is the number of bytes currently writ‐
48 ten into the channel.
49
50 Note that the two lengths are switched for the channels of a pair. In
51 other words, the number of bytes written for one of the channels is the
52 number of bytes readable from the other end.
53
54 As the channels generated by fifo2 grow as necessary they are always
55 writable. This means that a writable fileevent-handler will fire con‐
56 tinuously.
57
58 The channels are also readable if they contain more than zero bytes.
59 Under this conditions a readable fileevent-handler will fire continu‐
60 ously.
61
63 fifo, memchan, null
64
66 channel, fifo, i/o, in-memory channel, memchan, stream
67
69 Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
70
71
72
73
74Memory channels 2.2 fifo2(n)