fifo2(n)
πΈ fifo2 β the manual page, but make it a group chat πΈ
okay bestie, so this is fifo2(n) from the Tcl manual pages, and honestly? it's giving tiny command, big energy. let's get into it π
β¨ NAME β¨
fifo2 β create and manipulate pipe fifo channels π
β¨ SYNOPSIS β¨
package require Tcl
package require memchan
fifo2
β¨ DESCRIPTION β¨
real talk first: the command described here is only available in a not-yet released version of the package. not released. not out. if you want the sources you gotta use the CVS. that's the tea π«
okay so fifo2 creates two stream-oriented in-memory channels and returns their handles as a two-element list. 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. they just keep growing, main character energy, no cap π±
now here's the plot twist that makes this different from 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. this also means that the two channels of the pair are not seekable β no rewinding, no scrolling back, it's a one-way vibe 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, you can use them to create a bidirectional connection between two interpreters. iconic behavior fr fr π
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. literally "how much can i read rn" π-wlengthβ the value of this option is the number of bytes currently written into the channel. literally "how much has been written rn" βοΈ
heads up bestie: 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. mirror mirror πͺβ¨
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. it never chills π
the channels are also readable if they contain more than zero bytes. under these conditions a readable fileevent-handler will fire continuously too. so yeah, if you're not careful your event loop is gonna be doing cardio πβοΈπ¨
β¨ SEE ALSO β¨
fifo, memchan, null π¦
β¨ 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 came to you courtesy of Memory channels, version 2.2, under the name fifo2(n) β go forth and connect some interpreters, you absolute legend πβ¨π
π¦ where this page comes from
- fedora 43: memchan 2.3-34.fc43 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 43: memchan 2.3-34.fc43 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 44: memchan 2.3-35.fc44 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 44: memchan 2.3-35.fc44 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- 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