When an application no longer requires the use of a particular service, it issues a WFSClose or WFSAsyncClose request. The WOSA/XFS subsystem then closes that session as follows:
The XFS Manager calls the service provider's WFPClose function.
The service provider schedules the request for deferred processing, and returns immediately to the XFS Manager. Note that at this point the service handle, hService, is no longer valid.
At some point, the service provider processes the deferred close request, communicating with the service as necessary to accomplish the request.
Requests that were issued by the application before the close are executed.
If the calling application has the service locked under the same hService, the service provider unlocks it automatically (following the standard lock policy as defined in Section 3.8).
The service cleans up its administrative information (removes WFSRegister entries etc.).
If the WOSA/XFS subsystem loses connection to an application, it closes the session as described above, and:
An “application disconnect” event (SYSTEM_EVENT class) is generated.
Since messages can no longer be posted to the application, any command completion and event notification messages from this service for the application are converted to “undeliverable message” events (SYSTEM_EVENT class).
Note that it is required that some application have registered for system events, or these events are effectively not reported.