Called when a service is closed.
DWORD xxxCloseService (CTAHD ctahd, void *mgrcontext, char *svcname, unsigned svcid)
|
Argument |
Description |
|
ctahd |
Context handle. |
|
mgrcontext |
Pointer to context returned by xxxOpenServiceManager. |
|
svcname |
Pointer to the name of the service to close. |
|
svcid |
Identifier of the service to close. |
SUCCESS or any Natural Access or service-specific error code.
CTAEVN_CLOSE_SERVICE_DONE with the reason CTA_REASON_FINISHED, or an error code.
xxxCloseService is invoked when a service is closed on a context using ctaCloseServices, ctaDestroyContext, or ctaDestroyQueue. Both the service name (svcname) and service ID (svcid) are supplied as well as the manager context (mgrcontext) provided by the service manager in the call to xxxOpenServiceManager.
Services that do not require asynchronous close service processing must queue CTAEVN_DISP_CLOSE_SERVICE_DONE using dispMakeAndQueueEvent so that ctaCloseServices does not hang.
Resources allocated in xxxOpenService should be deallocated with this function call. Also, if RTC notifications were set up using dispAddRTC when the service was initialized, xxxCloseService should call dispRemoveRTC to remove its RTC notifications from the RTC database. If aliases were added at initialization time, xxxCloseService should also call dispUnregisterRTCAlias to remove the aliases from the RTC database.
The value field of the xxxCloseService completion event is set to CTA_REASON_FINISHED if the service was closed successfully or to any Natural Access or service-specific error message if there are problems closing the service.
In case of a synchronous error or an asynchronous error, Natural Access reports it in the Natural Access trace log and continues to close services. After the last service is closed, ctaCloseServices returns the first error to occur in the value field of CTAEVN_CLOSE_SERVICES_DONE. If all services are successfully closed, the value field contains CTA_REASON_FINISHED.
For more information about this function, refer to Shutting down services.