ACSE/Presentation and ROSE Interface Programmer's Guide

Chapter 4 63
Programming Guide
6. Other Tasks
Signal handlers can be written to capture signals and exit, or to prevent
signals from interrupting critical call sequences.
Error Checking Routines
Along with processing signals, ACSE/Presentation applications need to
check for return codes from calls and particular error conditions that are
returned. Error conditions related to ACSE/Presentation as well as other
protocol errors can be returned.
The global variable ap_errno and the ap_error() function are used for
error reporting. The ap_error() call prints an ASCII string error message
corresponding to the last received ap_errno. A/P library errors and
system errors can be received in the ap_errno variable.
A list of A/P specific errors you can access using ap_error() is included in
the ap_intro manpage.
For determining where problems occur, you can also use API tracing
which is described in Chapter 5,Ttroubleshooting your Application.
Error-handling in Multi-Threaded
Applications
Multi-threaded applications must define ap_errno as:
extern unsigned long _ap_errno()
#define ap_errno _ap_errno()
This ensures that the application can still use ap_errno which would
return the thread-specific ap_errno value to the application.