DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

udi_channel_close(3udi)


Close a channel

SYNOPSIS

#include <udi.h>

void udi_channel_close ( udi_channel_t channel );
 

ARGUMENTS channel is a channel handle for the channel endpoint being closed.

DESCRIPTION udi_channel_close deallocates and returns any channel-related resources to the UDI environment. Normally a driver calls this routine only as a result of receiving a channel_event_ind operation of type UDI_CHANNEL_CLOSED, to close its end of the channel.

The result of this routine is immediate: the channel endpoint will be closed and freed when this call returns. It is the responsibility of the driver to clean up all channel-related state and resources first, so as to maintain architectural integrity before destroying a channel. This must include the processing of all outstanding operations related to the channel. The driver should ensure, via proper channel operation handling, that all operations directed to this channel have been completed and that no more will be generated. Any operations previously sent to this channel but not yet delivered at the time this routine is called will be treated as having been initiated after the channel was closed.

When one end of a channel is closed, either by the driver explicitly calling udi_channel_close or by the environment if a driver is killed, the other end receives a udi_channel_event_ind operation of type UDI_CHANNEL_CLOSED. This tells the driver at the other end that one of its neighbors has gone away unexpectedly. (See page 16-13 for the definition of the udi_channel_event_ind operation).

udi_channel_close may be used on loose ends, as well as anchored channel endpoints.

If a driver calls udi_channel_close on a channel whose other end is loose, the udi_channel_event_ind operation will be delivered if and when that other end is anchored.

If a driver invokes an operation on a channel whose other end is closed, it will be ignored and any associated control blocks and data objects will be freed.

Once both ends of a channel are closed, all environment resources associated with the channel are released. Calling udi_channel_close on the single end of a half-spawned channel has this effect as well.

udi_channel_close acts as a no-op if channel is a null handle, but must not be called for a channel that has already been closed with a previous call to udi_channel_close.

WARNINGS udi_channel_close must not be used with a channel handle that has been passed to another region. udi_channel_close must not be used on management channels.

REFERENCES udi_channel_event_ind, udi_channel_anchor, udi_channel_spawn


UDI Core Specification Contents