HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)

Writing CPI-C Applications
Windows Considerations
Chapter 2108
Blocking Calls
This section describes how blocking CPI-C calls (calls issued with the
conversation's processing mode set to CM_BLOCKING) operate in the
Win32 environment if the calling application is single-threaded.
(Typically, a Win32 application would use multiple threads to avoid the
problem of a blocking verb blocking the entire application.)
The section also provides information that you need to be aware of when
writing applications to use blocking calls.
SNAplus2 provides support for blocking calls on Windows systems to
assist in migrating applications from other operating system
environments. However, the use of blocking calls in the Windows
environment is strongly discouraged. If you are writing a new
application specifically for Windows, you should do the following:
Use the Specify_Windows_Handle function to specify a Windows
handle to which CPI-C posts the results of call completion
Issue all CPI-C calls in nonblocking mode
Although a blocking call appears to suspend the application until CPI-C
has finished processing the call, the CPI-C library has to yield control of
the system while waiting for SNAplus2 to complete the processing, in
order to enable other processes to run. To do this, it uses a “blocking
function”, which is called repeatedly while the library is waiting; the
function enables Windows messages to be sent to other processes. For
more information about this function, see “Default Blocking Function”.
It is possible for the blocking function to send a message to the
application that issued the original blocking call; in this case, the
application can be reentered even though it has a blocking call
outstanding. In these circumstances, the application can continue with
other processing not related to issuing CPI-C calls. However, it cannot
issue another blocking call while the first call is outstanding.
The application can check whether a blocking call is outstanding (that is,
whether it has been reentered as a result of a received message while the
call was outstanding) by using the WinCPICIsBlocking() function,
described in Chapter 3, “CPI-C Calls.” If this function indicates that a
blocking call is outstanding, the application should not attempt to issue
further blocking CPI-C calls. It can, however, do the following:
Continue with other processing