[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]
tcl::chan::halfpipe - In-memory channel, half of a fifo2
package require Tcl 8.5 9
package require TclOO
package require tcl::chan::events ?1?
package require tcl::chan::halfpipe ?1.0.1?
The tcl::chan::halfpipe package provides a command creating one half of a tcl::chan::fifo2 pair. Writing into such a channel invokes a set of callbacks which then handle the data. This is similar to a channel handler, except having a much simpler API.
This command creates a halfpipe channel and configures it with the callbacks to run when the channel is closed, data was written to it, or ran empty. See the section Options for the list of options and associated semantics. The result of the command is a list containing two elements, the handle of the new channel, and the object command of the channel handler, in this order. The latter is supplied to the caller to provide her with access to the put method for adding data to the channel.
Two halfpipes with a bit of glue logic in the callbacks make for one tcl::chan::fifo2.
This method of the channel handler object puts the data bytes into the channel so that it can be read from it.
This callback is invoked when the channel is closed. A single argument is supplied, the handle of the channel being closed. The result of the callback is ignored.
This callback is invoked when data is written to the channel. Two arguments are supplied, the handle of the channel written to, and the data written. The result of the callback is ignored.
This callback is invoked when the channel has run out of data to read. A single argument is supplied, the handle of the channel.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category virtchannel of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
Copyright © 2009, 2019 Andreas Kupries