fifo2(3tcl)
π fifo2 β the tea ββ¨
okay so bestie, welcome to fifo2, from the 3tcl manual section, aka the page that's gonna teach you how to "Create and manipulate pipe fifo channels" π. it's giving plumbing but make it glam. let's go π
β¨ SYNOPSIS β¨
package require Tcl
package require memchan
fifo2
like, that's it. three little lines. iconic behavior honestly π«Ά
πΈ DESCRIPTION πΈ
β οΈ real talk first: the command described here is only available in a not-yet released version of the package. use the CVS to get the sources. yes, CVS. we're being vintage today π°οΈπ
so fifo2 creates two stream-oriented in-memory channels and returns their handles as a two-element list π. and here's the slay part: there is no restriction on the ultimate size of the channels β they will always grow as much as is necessary to accommodate the data written into them. no cap. infinite glow-up πβ¨
now, in contrast to the channels generated by fifo, a pair of channels created here is connected internally in such a way that data written into one channel can be read from the other π¦. all data written into them is read in the same order β first in, first out, main character energy only. this also means that the two channels of the pair are not seekable π no scrubbing back, bestie, we only move forward.
the channels created here can be transferred between interpreters in the same thread and between threads π. and because both channels in the pair can be transferred independently, they can be used to create a bidirectional connection between two interpreters. literally a whole group chat between two interpreters. iykyk π¬π
memory channels created by fifo2 provide two read-only options which can be queried via the standard fconfigure command. these are:
-rlengthβ the value of this option is the number of bytes currently available for reading from the channel π-wlengthβ the value of this option is the number of bytes currently written into the channel βοΈ
note that the two lengths are switched for the channels of a pair π. in other words, the number of bytes written for one of the channels is the number of bytes readable from the other end. it's giving mirror moment πͺβ¨
as the channels generated by fifo2 grow as necessary, they are always writable π. this means that a writable fileevent-handler will fire continuously. like. constantly. forever. she never rests ππ₯
the channels are also readable if they contain more than zero bytes π. under this conditions a readable fileevent-handler will fire continuously too. yes bestie, continuously. both of them. always. we stay alert ππ
π SEE ALSO π
fifomemchannull
go read those too, they're the friend group π«Ά
π 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, bestie π this was Memory channels, version 2.2, page fifo2(3tcl) β mwah, go forth and pipe responsibly πΈβ¨π
π¦ 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