From 44c8eee8ee63f4e18181c2e46b85a6561cd32a74 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 22 Jan 2009 15:23:40 +0000 Subject: [PATCH] Put back in the code that (de-)registers threads and catches exceptions. git-svn-id: https://svn.dealii.org/trunk@18262 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/thread_management.h | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/deal.II/base/include/base/thread_management.h b/deal.II/base/include/base/thread_management.h index a2d7efa69f..bf56e0a51e 100644 --- a/deal.II/base/include/base/thread_management.h +++ b/deal.II/base/include/base/thread_management.h @@ -1260,7 +1260,32 @@ namespace Threads void thread_entry_point (const std_cxx0x::function function, return_value *ret_val) { - call (function, *ret_val); + // now call the function + // in question. since an + // exception that is + // thrown from one of the + // called functions will + // not propagate to the + // main thread, it will + // kill the program if + // not treated here + // before we return to + // the operating system's + // thread library + internal::register_thread (); + try + { + call (function, *ret_val); + } + catch (const std::exception &exc) + { + internal::handle_std_exception (exc); + } + catch (...) + { + internal::handle_unknown_exception (); + } + internal::deregister_thread (); } }; -- 2.39.5