HP 800 ACSE/Presentation and ROSE Interface Programmer's Guide - Page 63

Error Checking Routines, Error-handling in Multi-Threaded, Applications - error codes

Page 63 highlights

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. Chapter 4 63

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109

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.