1
2fifo2(n)                                                              fifo2(n)
3
4
5

NAME

7       fifo2 - Create and manipulate pipe fifo channels
8

SYNOPSIS

10       package require Tcl
11
12       package require memchan
13
14       fifo2
15
16

DESCRIPTION

18       The command described here is only available in a not-yet released ver‐
19       sion of the package. Use the CVS to get the sources.
20
21       fifo2  creates two stream-oriented in-memory channels and returns their
22              handles  as  a  two-element list. There is no restriction on the
23              ultimate size of the channels, they will always grow as much  as
24              is necessary to accomodate the data written into them.
25
26              In contrast to the channels generated by fifo a pair of channels
27              created here is connected internally in such  a  way  that  data
28              written  into  one  channel can be read from the other. All data
29              written into them is read in the same  order.  This  also  means
30              that the two channels of the pair are not seekable.
31
32              The channels created here can be transfered between interpreters
33              in the same thread and between threads. As both channels in  the
34              pair  can be transfered independently they can be used to create
35              a bidirectional connection between two interpreters.
36
37       Memory channels created by fifo2 provide two  read-only  options  which
38       can be queried via the standard fconfigure command. These are
39
40       -rlength
41              The value of this option is the number of bytes currently avail‐
42              able for reading from the channel.
43
44       -wlength
45              The value of this option is the number of bytes currently  writ‐
46              ten into the channel.
47
48       Note  that  the two lengths are switched for the channels of a pair. In
49       other words, the number of bytes written for one of the channels is the
50       number of bytes readable from the other end.
51
52       As  the  channels  generated by fifo2 grow as necessary they are always
53       writable. This means that a writable fileevent-handler will  fire  con‐
54       tinuously.
55
56       The  channels  are  also readable if they contain more than zero bytes.
57       Under this conditions a readable fileevent-handler will  fire  continu‐
58       ously.
59

SEE ALSO

61       memchan, fifo, null
62

KEYWORDS

64       fifo, stream, memchan, in-memory channel, channel, i/o
65
67       Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
68
69
70
71Memory channels                       2.2                             fifo2(n)
Impressum