[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


5.2.12 Determining Whether Two Exceptions Match

The pthread_exc_matches_np() function compares two exception objects, taking into consideration whether they are address or status exceptions, and possibly other system-specific rules for matching status values. Whenever you need to compare two exceptions, you should use this function. For example:

int pthread_exc_matches_np (EXCEPTION *exception1,
       EXCEPTION *exception2);

EXCEPTION my_status;

EXCEPTION_INIT (&my_status);
pthread_exc_set_status_np (&my_status, status_code);
   .
   .
   .
if (pthread_exc_matches_np (THIS_CATCH, &my_status))
   fprintf (stderr, "This is my exception\n");