#include #include #include #include void * thread_f (void *) { try { cout << "Thread has started " << endl; for (;;) sleep (10000); } catch (int i) { cout << "Exception catched in thread" << endl; } } int main () { try { pthread_t thread; pthread_create (&thread, 0, thread_f, 0); sleep (2); throw 10; } catch (int i) { cout << "exception catched in main" << endl; } }