Termination of Asynchronous Operations

When an application calls the lineClose function with one or more outstanding asynchronous operations, TAPI may direct the service provider to terminate asynchronous operations assocated with a call, depending on whether the application is the sole owner of the call and has the only handle to the call.

If the application is the sole owner of a call, TAPI calls TSPI_lineDropOnClose or TSPI_lineDrop (depending on the provider) for each such call. The service provider should check for any pending asynchronous operations associated with the call being dropped. If a pending operation exists, the service provider should take the appropriate action, possibly terminating the operation in progress.

If the application has the only handle to a call (that is, there are no other owners or monitors), TAPI calls the TSPI_lineCloseCall function. The service provider must consider this call to be the absolute indication that pending asynchronous operations must be abandoned. The service provider must ensure an orderly completion of the call, and must call the ASYNC_COMPLETION callback function for all outstanding asynchronous operations, specifying the LINEERR_OPERATIONFAILED error value. If TAPI previously called the TSPI_lineDropOnClose or TSPI_lineDrop function, it calls TSPI_lineCloseCall immediately after the service provider returns from the other call; it does not wait for the asynchronous operation associated with the TSPI_lineDrop function to complete.

If the application is not the sole owner of the call, TAPI does not call TSPI_lineDropOnClose or TSPI_lineDrop. If the application does not have the only handle to the call, TAPI does not call the TSPI_lineCloseCall function. If the application is neither the sole owner nor the sole possessor of a handle to the call, TAPI sends no notification to the service provider, and therefore, any pending asynchronous operations remain intact. This means that such applications cannot terminate asynchronous operations that they have started by using the lineClose function. However, because every asynchronous operation requires the invoking application to be an owner of the call, the likelihood of an application not being able to terminate asynchronous operations is very rare. If it does occur, the other owner(s) of the call(s) must take responsibility for the disposition of the call(s).

If TAPI calls TSPI_lineDropOnClose or TSPI_lineDrop, the service provider must eventually send a LINECALLSTATE_IDLE message for the associated call (unless TSPI_lineCloseCall is called first) so that monitors on the call can clean up. When the last monitor has called the lineDeallocateCall function, TAPI calls the TSPI_lineCloseCall function; any pending operations must be completed or terminated and ASYNC_COMPLETION called, as described earlier.