Sophie

Sophie

distrib > Fedora > 15 > x86_64 > by-pkgid > c521da20bd4948864cf5bcbab78d30e5 > files > 6

memchan-2.2.1-8.fc15.x86_64.rpm

<! -- -*- tcl -*- doctools
   -->
<html><head><title>fifo - Memory channels </title></head>
<! -- Generated from file 'fifo.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright (c) 1996-2003 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;
   -->
<! -- CVS: $Id$ fifo.n
   -->

<h1> fifo(n) 2.1  &quot;Memory channels&quot;</h1>
<a name="name"><h2>NAME</h2>
<p> fifo - Create and manipulate u-turn fifo channels





<a name="synopsis"><h2>SYNOPSIS</h2>
package require <b>Tcl</b><br>
package require <b>memchan</b><br>
<br><table border=1 width=100% cellspacing=0 cellpadding=0><tr            bgcolor=lightyellow><td bgcolor=lightyellow><table 0 width=100% cellspacing=0 cellpadding=0><tr valign=top ><td ><b class='cmd'>fifo</b> </td></tr>
</table></td></tr></table>
<a name="description"><h2>DESCRIPTION</h2>
<dl>

<dt><b class='cmd'>fifo</b> <dd>


creates a stream-oriented in-memory channel and returns its
handle. There is no restriction on the ultimate size of the channel,
it will always grow as much as is necessary to accomodate the data
written into it.
<br><br>
In contrast to the channels generated by <b class='cmd'>memchan</b> a channel
created here effectively represents an U-turn. All data written into
it can be read out, but only in the same order. This also means that a
fifo channel is not seekable.
<br><br>
The channels created here can be transfered between interpreters in
the same thread and between threads, but only as a whole. It is not
possible to use them to create a bi- or unidirectional connection
between two interpreters.

</dl>
<p>
Memory channels created by <b class='cmd'>fifo</b> provide two read-only options
which can be queried via the standard <b class='cmd'>fconfigure</b> command. These
are

<dl>
	<dt>-length<dd>

	The value of this option is the number of bytes currently
	stored in the queried memory channel.

	<br><br>
<dt>-allocated<dd>
	The value of this option is the number of bytes currently
	allocated by the queried memory channel. This number is at
	least as big as the value of <em>-length</em>.
	
</dl>
<p>
As the channels generated by <b class='cmd'>fifo</b> grow as necessary they are
always writable. This means that a writable <b class='cmd'>fileevent</b>-handler
will fire continuously.

<p>
The channels are also readable if they contain more than zero
bytes. Under this conditions a readable <b class='cmd'>fileevent</b>-handler will
fire continuously.

<a name="notes"><h2>NOTES</h2>
<p>
One possible application of memory channels created by <b class='cmd'>memchan</b>
or <b class='cmd'>fifo</b> is as temporay storage device to collect data coming in
over a pipe or a socket. If part of the processing of the incoming
data is to read and process header bytes or similar fifo are easier to
use as they do not require seeking back and forth to switch between
the assimilation of headers at the beginning and writing new data at
the end.


<a name="seealso"><h2>SEE ALSO</h2>
memchan, fifo2, null
<a name="keywords"><h2>KEYWORDS</h2>
fifo, stream, memchan, in-memory channel, channel, i/o
<a name="copyright"><h2>COPYRIGHT</h2>
Copyright (c) 1996-2003 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;<br>
</body></html>