Windows CPI-C Asynchronous Support

A program that issues a call and does not regain control until the call completes cannot perform any other operations. This type of operation, referred to as blocking, is not suited to a server application designed to handle multiple requests from many clients. Asynchronous call completion returns the initial call immediately so the application can continue with other processes.

Windows CPI-C support related to asynchronous communications includes the following calls and extensions:

Set_Processing_Mode

Specify_Windows_Handle

Wait_For_Conversation

WinCPICExtractEvent

WinCPICIsBlocking

WinCPICSetBlockingHook

WinCPICSetEvent

WinCPICUnhookBlockingHook

Two methods under Windows NT and Windows 95 are available for asynchronous verb completion:

The traditional method uses messages posted to a window handle to notify an application of verb completion. This method using window handles and messages is also supported on Windows 3.x.

Asynchronous support using message posting is appended to the Set_Processing_Mode call and allows an application to be notified of call completion on a window handle. Calling RegisterWindowsMessage with "WinAsyncCPIC" as the string, an application passes a window handle by which the application is notified of call completion. The application then makes the CPI-C call, and when it completes a message is posted to the window handle that was passed, notifying the application that the call is complete.

With the exception of an asynchronous Receive call that can issue certain other calls while pending, a conversation can have only one incomplete operation at any time. For more information on using an asynchronous Receive call, see Using Asynchronous Call Completion. In the case of an incomplete operation, the program can issue Wait_For_Conversation to test for its completion or Cancel_Conversation to end the conversation and the incomplete operation.

A second method using Win32 events for notification is supported on Microsoft® SNA Server version 3.0. The extension functions using Win32 events (WinCPICSetEvent and WinCPICExtractEvent) will operate only on Windows NT and Windows 95. If an event has been registered with the conversation using WinCPICSetEvent, then an application can call the Win32 WaitForSingleObject or WaitForMultipleObjects function to wait to be notified of the completion of the verb.

The only Windows extension functions required for Windows CPI-C are for initialization (WinCPICStartup) and termination (WinCPICCleanup) purposes. Depending on your application, other Windows extensions for handling asynchronous verb completion can be useful, but they are not required. An example of how to use Windows CPI-C asynchronous calls and Windows extensions appears in Using Asynchronous Call Completion. A complete description of all Windows CPI-C calls and extensions appears in CPI-C Calls and Extensions for the Windows Environment.