VMS Help  —  DCE  DCE_THREADS, Application Routines, exceptions
 NAME

      exceptions - Exception handling in DCE Threads

 DESCRIPTION

 DCE Threads provides the following two ways to obtain information about
 the status of a threads routine:

        o    The routine returns a status value to the thread.

        o    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.  However,  an
 alternative  to  status  values  is provided by DCE Threads in the
 exception-returning interface.

 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 automat-
 ically when you include pthread_exc.h.

 To use the exception-returning interface, replace

    #include <pthread.h>

 with the following include statement:

    #include <pthread_exc.h>

 The following example shows the syntax for handling exceptions:

     TRY
         try_block
     [CATCH (exception_name)
         handler_block]...
     [CATCH_ALL
         handler_block]
     ENDTRY
Close Help