Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 21 - Providers Reference / Functions
Opening and Closing Providers /


OTCloseProvider

Closes a provider of any type--endpoint, mapper, or service provider.

C INTERFACE
OSStatus OTCloseProvider(ProviderRef ref);
C++ INTERFACE
OSStatus TProvider::Close()
PARAMETERS
ref
The provider reference of the provider to be closed.
function result
An error code. See Appendix B for more information.
DISCUSSION
The OTCloseProvider function closes the provider that you specify in the ref parameter. Closing the provider disposes of all memory reserved for it, deletes its resources, and cancels any provider functions that are currently executing.

If there are outstanding asynchronous calls when you close the provider, these calls will never complete. If there are outstanding synchronous calls, the calls will complete with the result of kOTCanceledErr.

The blocking/nonblocking status of the provider governs what actually happens when a provider is closed. In nonblocking mode, closing a provider flushes all outgoing commands in the stream before immediately closing the provider. In blocking mode, the stream is given up to 15 seconds per module to allow outgoing commands and data to be processed before closing the stream. Insofar as the caller is concerned, the provider is closed immediately.

WARNING
You need to be sure that there are no outstanding T_MEMORYRELEASED events for a provider before you close the provider. Otherwise, Open Transport attempts to deliver the event to a provider that no longer exists, with unpredictable results, such as crashing the system.
SEE ALSO
For information about opening different types of providers, please see the appropriate reference chapter in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998