Network Interface Guide

Asynchronous Execution Mode

Many XTI/TLI library routines block to wait for an incoming event. However, some time-critical applications should not block for any reason. An application can do local processing while waiting for some asynchronous XTI/TLI event.

Asynchronous processing of XTI/TLI events is available to applications through the combination of asynchronous features and the non-blocking mode of XTI/TLI library routines. Use of the poll(2) system call and the I_SETSIG ioctl(2) command to process events asynchronously is described in ONC+ Developer's Guide.

Each XTI/TLI routine that blocks for an event can be run in a special non-blocking mode. For example, t_listen(3NSL) normally blocks for a connect request. A server can periodically poll a transport endpoint for queued connect requests by calling t_listen(3NSL) in the non-blocking (or asynchronous) mode. The asynchronous mode is enabled by setting O_NDELAY or O_NONBLOCK in the file descriptor. These modes can be set as a flag through t_open(3NSL), or by calling fcntl(2) before calling the XTI/TLI routine. fcntl(2) enables or disables this mode at any time. All program examples in this chapter use the default synchronous processing mode.

O_NDELAY or O_NONBLOCK affect each XTI/TLI routine differently. You will need to determine the exact semantics of O_NDELAY or O_NONBLOCK for a particular routine.