Semisynchronous Processing

[This is preliminary documentation and subject to change.]

Semisynchronous processing is a compromise between synchronous processing and asynchronous processing, providing the advantages of each technique. Semisynchronous processing can be used by management applications to improve the speed and efficiency of processing queries, enumerations, and events.

With synchronous processing, applications call the methods of the IEnumWbemClassObject to retrieve objects. The application's thread is blocked until the call completes. This blockage can cause a lengthy delay in processing time.

With asynchronous query processing, applications must implement IWbemObjectSink. WBEM calls IWbemObjectSink::Indicate to deliver objects, allowing the application to continue with other work. One disadvantage with asynchronous processing is that it can be difficult for a provider or CIMOM to control the flow of information back to the application process. Large result sets can take a considerable amount of time to deliver, forcing the application to spend significant system resources to handle the delivery.

The semisynchronous technique solves both the thread blockage and uncontrolled delivery problems. To take advantage of semisynchronous query processing, an application:

  1. Calls IWbemServices::ExecQuery to execute the query.
  2. Calls IEnumWbemClassObject::Next or IEnumWbemClassObject::NextAsync using the ppEnum pointer returned by ExecQuery to retrieve the results of the query in small groups. The uCount parameter should be set to the number of objects to be returned in the group.
  3. Sets the pSink parameter if using NextAsync to point to an implementation of the IWbemObjectSink interface. As the implementor of NextAsync, CIMOM calls the IWbemObjectSink::Indicate method to deliver the query results asynchronously.

The IEnumWbemClassObject::NextAsync call is nonblocking and returns immediately. In the background CIMOM begins to deliver the requested number of objects by calling IWbemObjectSink::Indicate. It then stops, waiting for another NextAsync call. NextAsync places the number of objects actually returned in the lObjectCount parameter and the objects themselves in the contents of the ppObjArray parameter.

If the entire result set is not needed, an application should release the enumerator by calling IEnumWbemClassObject::Release. Calling this Release method results in CIMOM canceling its delivery of any remaining objects.