HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)
Writing CPI-C Applications
HP-UX Considerations
Chapter 2 97
NOTE
1. In general, SNA_GET_FD() returns the same file descriptor each time
you call it. However, you should call it before each call to select() or
poll(), because there are some situations (such as when your
application has issued the fork() call, or in error cases) when the
file descriptor may change.
2. The SNA event handler processes internal control messages between
SNAplus2 components, in addition to processing the completion of
CPI-C functions. In addition, if your application uses multiple
conversations and there are multiple functions outstanding on
different conversations, the SNA event handler may report the
completion of any of these functions (because the same file descriptor
is used for all conversations).
Because of this, you cannot assume that an event on the SNA file
descriptor corresponds to the completion of a particular CPI-C
function. Check_For_Completion is the correct method of checking
which function, if any, has completed. If Check_For_Completion
indicates that a function has completed, the application can then call
Wait_For_Conversation to obtain the results of the function.
3. If you are familiar with using application scheduling mode on other
SNAplus2 APIs, where the application calls the SNA event handler
using SNA_EVENT_FD(), note that the Check_For_Completion
function includes a call to SNA_EVENT_FD() and so you do not need to
call SNA_EVENT_FD() directly from a CPI-C application.
Signal-Based Scheduling Mode
In signal-based scheduling mode, the CPI-C library uses the SIGPOLL
signal to detect work arriving using the file descriptor.
Applications can require the SIGPOLL() signal for other purposes.
Therefore, the library daisy-chains to any existing signal catchers. The
first verb issued by the application initializes the library's signal catcher.
When the SIGPOLL() signal arrives, either it indicates work for
SNAplus2 or it was generated for some other reason. The CPI-C library's
signal catcher processes the signal and then calls the previous signal
catcher to enable the signal to be used for other purposes.