The Callback Interface

The tcp package supplies a callback interface, which is a way of arranging for a predicate to be called whenever some tcp event occurs. This is especially useful for applications that can not wait at one of the tcp_select predicates. A callback is a predicate that is called when some condition is met. Callbacks are called when your process is in some wait state. It uses the callback facility described in relation to the Quintus supplied C functions QP_select() and QP_add_input().

For example, applications that use the callbacks defined in the Quintus X Toolkit interface (xif) use callbacks extensively. Before the callback interface to library(tcp) was provided, there was no way for a graphics program to both service its callbacks and service library(tcp) without polling.

Although this interface may seem primitive, it has the advantage of being able to be used by separate subcomponents of a larger system since the requirement that the application wait at tcp_select/[1,2] is lifted.