Previous: The Main Program, Up: A Quick Tour of CLX [Contents][Index]
Typically, most CLX programs do not need to control the buffering of output requests directly. However, CLX programmers need to be aware of the asynchronous nature of client-server communication. It may be convenient to control the CLX output buffer more directly, especially during debugging.
A client that wants a request to execute immediately instead of asynchronously can follow it with a call to display-force-output (see display-force-output). This function blocks (does not return) until all previously buffered output requests have been sent. Otherwise, the output buffer is always flushed by a call to any function which returns a value from the server or which waits for input (for example, get-property (see get-property). Certain output requests can cause input events to be sent. For example, map-window (see map-window) can cause :exposure (see exposure) events to be sent. Synchronizing output with the resulting input can be done with the display-finish-output (see display-finish-output) function. This function blocks until all previously buffered output has been sent and all resulting input events have been received.
Functions that return information from the server block until an explicit reply is received or an error occurs. If a nonblocking call results in an error, the error is generally not reported until later. All errors (synchronous and asynchronous) are processed by calling an error handler defined for the display. If the handler is a sequence it is expected to contain handler functions specific to each error. The error code is used to index the sequence, fetching the appropriate handler. Any results returned by the handler are ignored since it is assumed that the handler either takes care of the error completely, or else signals.
Previous: The Main Program, Up: A Quick Tour of CLX [Contents][Index]