fifo(3tcl)
๐ fifo โ the manual page, bestie edition ๐
okay so real talk, this is fifo from the Tcl manual, section 3tcl. it's a whole page about making u-turn fifo channels and honestly? it's giving iconic. let's get into it ๐ซถ
โจ NAME โจ
fifo โ create and manipulate u-turn fifo channels ๐
โจ SYNOPSIS โจ
package require Tcl
package require memchan
fifo
โจ DESCRIPTION โจ
so fifo creates a stream-oriented in-memory channel and hands you back its handle. that's it, that's the whole vibe ๐
and there is no restriction on the ultimate size of the channel, bestie โ it will always grow as much as is necessary to accommodate the data written into it. it does not care. it will simply expand. queen behavior ๐
now here's the tea: in contrast to the channels generated by memchan, 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. no rewinding, no scrubbing, no taking it back. it's a one-way street that loops around, iykyk ๐ญ
the channels created here can be transferred 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. so don't try it, she's not that kind of channel ๐
memory channels created by fifo provide two read-only options which can be queried via the standard fconfigure command. these are:
-lengthโ the value of this option is the number of bytes currently stored in the queried memory channel ๐-allocatedโ 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-length๐งฎ
as the channels generated by fifo grow as necessary they are always writable. this means that a writable fileevent-handler will fire continuously. like, constantly. forever. she never stops talking ๐ฅ
the channels are also readable if they contain more than zero bytes. under this conditions a readable fileevent-handler will fire continuously. (yes bestie, "this conditions" โ that's what the original says, we don't edit the queen's grammar ๐)
โ ๏ธ heads up: those continuously-firing handlers are literally in the spec. don't come for me, come for the fileevent system.
โจ NOTES โจ
one possible application of memory channels created by memchan or fifo is as a temporary 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. no bouncing around, just vibes โจ
โจ SEE ALSO โจ
fifo2memchannull
go read those too, bestie, they're all in the group chat ๐
โจ KEYWORDS โจ
- channel
- fifo
- i/o
- in-memory channel
- memchan
- stream
โจ COPYRIGHT โจ
Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page, no cap. this was Memory channels, version 2.1, filed under fifo(3tcl) โ huge thank you to Andreas Kupries for writing it back in 1996-2003, an absolute legend, we stan ๐ ๐ฆ
๐ฆ where this page comes from
- debian trixie: tcl-memchan 2.3+dfsg-2
- ubuntu questing: tcl-memchan 2.3+dfsg-2
- ubuntu resolute: tcl-memchan 2.3+dfsg-2build1
- ubuntu stonking: tcl-memchan 2.3+dfsg-5
- Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms