OSF DCE Application Development Guide--Core Components
Chapter 9. Using the DCE Threads Exception-
Returning Interface
DCE Threads provides the following two ways to obtain information about the status of a
threads routine:
• The routine returns a status value to the thread.
• The routine raises an exception.
Before you write a multithreaded program, you must choose only one of the preceding
two methods of receiving status. These two methods cannot be used together in the same
code module.
The POSIX P1003.4a (pthreads) draft standard specifies that errors be reported to the
thread by setting the external variable errno to an error code and returning a function
value of -1. The threads reference pages document this status-value-returning interface
(see the OSF DCE Application Development Reference). However, an alternative to
status values is provided by DCE Threads in the exception-returning interface.
This chapter introduces and provides conventions for the modular use of the
exception-returning interface to DCE Threads.
9.1 Syntax for C
Access to exceptions from the C language is defined by the macros in the
exc_handling.h file. The exc_handling.h header file is included automatically when
you include pthread_exc.h (see Section 9.2).
The following example shows the syntax for handling exceptions:
TRY
try_block
[CATCH (exception_name)
handler_block]...
[CATCH_ALL
handler_block]
124245 Tandem Computers Incorporated 9−1