io_select(prog_tools) Programming Tools io_select(prog_tools)
NAME
io_select -- multiple input source co-ordinator for all
Lymb i/o.
DESCRIPTION
The io_select object allows LYMB to select input from a
number of sources and take a particular action whenever
input is available on a given source. This is done by
registering callback actions or functions for specific
file descriptors. There is an object/message interface
for use within scripts as well as a function callback
interface for efficient use within C code. If the "xt"
class is present in the system, it uses xt's facilities
for blocking on multiple sources to allow intrinsics timeouts to be processed in addition to i/o on real file or
socket descriptors.
The lymb parser uses the io_select object to allow other
input sources (such as X events) to be processed while it
is waiting for input from the keyboard. In addition to
keyboard input and X events, the io_select object is used
for dispatching signal handlers, sending "read!" messages
to network objects in auto_read mode, and processing
incoming requests for netserver_filter objects and
lymb_process objects (in server or slave mode).
SUPERCLASS
object
INSTANCE VARIABLES
None
MESSAGES
register_function(fd,func,data)
Takes three arguments, an integer file descriptor,
a function pointer, and an arbitrary data pointer.
When input becomes available on the file descriptor, the corresponding function is called with the
corresponding data pointer as an argument.
register_object:(fd,object_name,message)
Takes three arguments, an integer file descriptor,
an object name, and a message. When input becomes
available on the file descriptor, the corresponding
message is sent to the corresponding object.
unregister:(fd)
Removes any callbacks associated with the file
descriptor
block_on:(fd)
Waits for input to become available on the indicated file descriptor and then returns. While waiting, it dispatches callbacks for file descriptors
that have been previously registered. This method
should not be used to block on file descriptors
that have previously been registered for callback.
This message also implicitly dispatches X events.
This message is used by the parser.
process_inputs!
Dispatches callbacks for whatever file descritors
currently have input available. It also implicitly
dispatches X events. This message never blocks.
This message is used by ui_scene and motif_scene to
process input sources between ticks.
main_loop!
If the application needs to do nothing other than
process callbacks for previously registered
descriptors, it may issue this message after setting up all necessary callbacks. This message never
returns.
initialize
Private message used internally before any other
messages are sent. Performs some internal initialization consisting of detecting for presence of the
"xt" class (and initializing that if present),
determining the maximum number of file descriptors
available to the process, and initializing the
internal callback tables.
NOTES
If an end-of-file condition occurrs on a a registered file
descriptor (or a file descriptor currently being blocked
on), the io_select object will dispatch the appropriate
callback (or return from the "block_on:" message) as if
input were available on that file descriptor. This is due
to the fact that under such a condition an attempt to read
will not block. In the event of a registered descriptor,
the client must, within the callback, detect this condition and unregister the descriptor. Otherwise, the callback will continue to be invoked.
EXAMPLE
This class will rarely be used by the end user. It will be
used mainly by the classes mentioned above. The user may,
on occasion, use the "register_object:" message, but there
aren't any uses "typical" enough to serve as an example.
SEE ALSO
parser, signal_handler, netserver_filter, lymb_process,
network
Please send comments and suggestions toconsult@rpi.edu