Current Path : /usr/src/tools/regression/pthread/unwind/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/src/tools/regression/pthread/unwind/catch_pthread_exit.cpp |
/* $FreeBSD: release/9.1.0/tools/regression/pthread/unwind/catch_pthread_exit.cpp 213155 2010-09-25 04:26:40Z davidxu $ */ /* try to catch thread exiting, and rethrow the exception */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> int caught; void * thr_routine(void *arg) { try { pthread_exit(NULL); } catch (...) { caught = 1; printf("thread exiting exception caught\n"); /* rethrow */ throw; } } int main() { pthread_t td; pthread_create(&td, NULL, thr_routine, NULL); pthread_join(td, NULL); if (caught) printf("OK\n"); else printf("failure\n"); return (0); }