#include #include #include extern "C" void * __get_eh_context (); static void* saved_eh_context = 0; static void* func(void*) throw(char*) { void* eh_cntxt = __get_eh_context(); printf("func() - eh_context = %X\n", eh_cntxt); if(saved_eh_context == 0) { saved_eh_context = eh_cntxt; } else { if(eh_cntxt == saved_eh_context) { printf("FATAL: Identical Exception Stacks!\n"); } else { printf("Great! Exception Stacks Differ.\n"); } } int svar = 5; try { throw 1; } catch(char*) { printf("caught string\n"); } catch(int) { // nothing } poll(0, 0, 5000); return 0; } int main() { pthread_t thr, thr2; pthread_create(&thr, 0, &func, 0); poll(0, 0, 1000); pthread_create(&thr2, 0, &func, 0); pthread_join(thr, 0); pthread_join(thr2, 0); return 0; }