All Manuals > LispWorks® User Guide and Reference Manual > 32 The COMM Package

async-io-state-shutdown Function

Summary

Performs a shutdown on the socket associated with async-io-state.

Package

comm

Signature

async-io-state-shutdown async-io-state direction &key abort callback => result

Arguments
async-io-state
direction
One of :input, :output or :io.
abort
A boolean.
callback
nil or a function of two arguments.
Values
result
t, nil or an error code number.
Description

The function async-io-state-shutdown performs a shutdown on the socket associated with async-io-state.

When direction is :input, receive operations are shut down. When direction is :output, send operations are shut down. When direction is :io, all operations are shut down.

If async-io-state is currently scheduled for an I/O operation in the direction specified direction (by async-io-state-read-buffer or async-io-state-write-buffer), then the behavior of async-io-state-shutdown is determined by the value of abort:

If callback is not nil, it must be a function that takes two arguments. After the shutdown, callback is called with async-io-state and an argument indicating the result of the shutdown, which will be t for success and otherwise is an integer that is the error code.

async-io-state-shutdown returns nil when it needs to abort as described as above. Otherwise, it is synchronous and returns the result of the shutdown (the same value that is passed to callback).

Notes

The error code is errno on Unix-like systems or a Windows error code on Windows and is the result of calling the C function shutdown.

Normally you would perform a shutdown after finishing any I/O operations, in which case async-io-state-shutdown is synchronous and you do not need to supply abort and callback. If you need to know the result of the shutdown, you can look at result.

If you want to abort when an I/O operation is still going on, then you need to supply non-nil for abort. If you also need to know the result or do something after the shutdown, then you need to supply callback too. Note that if async-io-state-shutdown does abort, then callback is called asynchronously, possibly on another thread. If it does not need to abort, callback is called synchronously.

See also

async-io-state
25.8.2 The Async-I/O-State API


LispWorks® User Guide and Reference Manual - 18 Feb 2025 15:32:11