next up previous contents
Next: Using SERVE-EVENT with the Up: Event Dispatching with SERVE-EVENT Previous: The SERVE-EVENT Function

Using SERVE-EVENT with Unix File Descriptors

Object sets are not available for use with file descriptors, as there are only two operations possible on file descriptors: input and output. Instead, a handler for either input or output can be registered with system:serve-event for a specific file descriptor. Whenever any input shows up, or output is possible on this file descriptor, the function associated with the handler for that descriptor is funcalled with the descriptor as it's single argument.

[Function]
system:add-fd-handler fd direction function

This function installs and returns a new handler for the file descriptor fd. direction can be either :input if the system should invoke the handler when input is available or :output if the system should invoke the handler when output is possible. This returns a unique object representing the handler, and this is a suitable argument for system:remove-fd-handler function must take one argument, the file descriptor.

[Function]
system:remove-fd-handler handler

This function removes handler, that add-fd-handler must have previously returned.

[Macro]
system:with-fd-handler (direction fd function) tex2html_wrap_inline17166formtex2html_wrap_inline17172

This macro executes the supplied forms with a handler installed using fd, direction, and function. See system:add-fd-handler.

[Function]
system:wait-until-fd-usable direction fd &optional timeout

This function waits for up to timeout seconds for fd to become usable for direction (either :input or :output). If timeout is nil or unspecified, this waits forever.

[Function]
system:invalidate-descriptor fd

This function removes all handlers associated with fd. This should only be used in drastic cases (such as I/O errors, but not necessarily EOF). Normally, you should use remove-fd-handler to remove the specific handler.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997