fifo2(3tcl)

πŸ“¦
version 2.3 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 🌈

  • fifo
  • memchan
  • null

go read those too, they're the friend group 🫢


πŸŽ€ KEYWORDS πŸŽ€

channel, fifo, i/o, in-memory channel, memchan, stream


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