Description of the provided commands


[ UpHome | Sitemap ]      


This extension provides two new commands and influences the kernel command fconfigure.

::
Subcmd Description
memchan

Command to create a new memory channel. Returns the handle of the created channel. Accepts a single option, '-initial-size'. The argument to the option is a number, it specifies the number of bytes to pre-allocate for the internal buffers.

fifo

Command to create a new memory channel with fifo characteristics. No arguments, no options. Returns the handle of the created channel.

The introduction already told us that these channels are useful to transfer large amounts of data between procedures or interpreters. The difference is this: memchans are block-oriented, fifos on the other hand are stream-oriented. With a memchan the producer fills the memory channel with the relevant data and then transfers control to the consumer. With a fifo producer and consumer may work in parallel. This is currently only possible for an event-driven application, but the moment additional interfaces come up, allowing me to transfer a channel between threads this concept may find its real use for inter-thread communication of bulk information; whose transfer through the currently implemented send-oriented interface (see tclTestThread.c) is awkward. fifos complement this interface, they don't replace it.

fconfigure
... -length -allocated ...

Memory and fifo channels support a two read-only options, -length and -allocated. Reading the first via fconfigure retrieves the number of bytes currently stored in the channel. Reading the second retrieves the number of bytes currently allocated by the internal buffers. This number is usually greater than the one reported by -length, but never smaller.


© Andreas Kupries

Last update at Wed Oct 04 20:37:32 MEST 2000