异步调用完成
除了一个例外,Microsoft® Host Integration Server 允许每个连接一个未完成的 Windows® SNA 异步调用,每个线程一个阻塞谓词。 例外情况是发出异步 Receive 调用时,可以在 Receive 未完成时发出以下调用:
-
这使应用程序(尤其是 5250 仿真器)能够使用异步 接收 来接收数据。 强烈建议使用此功能。
以下示例演示如何对 Host Integration Server 使用异步调用完成:
void ProcessVerbCompletion (WPARAM wParam LPARAM lParam)
{
for ( i = 0; i<nPendingVerbs; i++ )
if (memcmp (pPending [i].ConvID, (Conversation_ID) lParam)== 0)
ProcessCommand (wParam, lParam);
}
LRESULT CALLBACK SampleWndProc ( . . .)
{
if (msg = = uAsyncCPIC ) {
ProcessVerbCompletion (wParam, lParam);
}
else switch (msg) {
case WM_USER:
Initialize_Conversation (lpConvId, "GORDM", &lError );
if (lError ! = CM_OK ) {
ErrorDisplay ( ) ;
break ;
}
Set_Processing_Mode (lpConvId, CM_NON_BLOCKING, &lError ) ;
if ( lError ! = CM_OK ) {
ErrorDisplay ( ) ;
break ;
}
Allocate (lpConvId, &lError ) ;
switch (lError ) {
case CM_OK:
break ;
case CM_OPERATION_INCOMPLETE:
memcopy (pPending [nPending ++].ConvId, lpConvId, sizeof (C) ;
break ;
default:
ErrorDisplay ( ) ;
}
break ;
}
WinMain ( . . . )
{
if ( ( WinCPICStartup ( . . . ) = = FALSE ) {
return FALSE;
}
uAsyncCPIC = RegisterWindowMessage ("WinAsyncCPIC"");
Specify_Windows_Handle (hwndSample) ;
while (GetMessage ( . . . ) ) {
. . . . .
}
WinCPICCleanup ( . . . )
}
有关 CPI-C 调用和 Windows 扩展的详细信息,请参阅适用于 Windows 环境的CPI-C 调用和扩展。 有关使用 CPI-C 的其他信息,请参阅 IBM Systems 应用程序体系结构通用编程接口通信参考,部件号 SC26-4399-04。