1 #include "../general_protection_fault.h"
3 #include "../../except.h"
10 struct floating_point_exception : virtual caspar_exception {};
11 struct segmentation_fault_exception : virtual caspar_exception {};
13 void catch_fpe(int signum)
17 CASPAR_THROW_EXCEPTION(floating_point_exception());
21 CASPAR_LOG_CURRENT_EXCEPTION();
26 void catch_segv(int signum)
30 CASPAR_THROW_EXCEPTION(segmentation_fault_exception());
34 CASPAR_LOG_CURRENT_EXCEPTION();
39 void do_install_handlers()
41 signal(SIGFPE, catch_fpe);
42 signal(SIGSEGV, catch_segv);
45 void install_gpf_handler()
47 ensure_gpf_handler_installed_for_thread();
50 void ensure_gpf_handler_installed_for_thread(
51 const char* thread_description)
53 static auto install = []() { do_install_handlers(); return 0; } ();