Closing services

The Natural Access close functions parallel the Natural Access initialization functions:

Use this function...

To...

ctaDetachObject

Disconnect the application from a service object on a server.

ctaCloseServices

Close one or more services on a context. The function is asynchronous and returns immediately. You must wait for the completion event CTAEVN_CLOSE_SERVICES_DONE.

If you are closing multiple services and more than one service close fails, the value field of the CTA_EVENT structure (ctaWaitEvent) contains the reason the first service failed to close.

ctaDestroyContext

Destroy a context. All currently open services are closed. The function is asynchronous and returns immediately. You must wait for the completion event, CTAEVN_DESTROY_CONTEXT_DONE, before the context is destroyed and resources are released. When using shared or persistent contexts, the context is not actually destroyed until the last application using it calls ctaDestroyContext.

ctaDestroyQueue

Destroy the event queue and all contexts associated with the event queue. This function is synchronous. The application remains blocked until all cleanup and close activity is complete. If the services and contexts are already closed, the function returns immediately.