1 #include "../general_protection_fault.h"
3 #include "../../except.h"
9 struct floating_point_exception : virtual caspar_exception {};
10 struct segmentation_fault_exception : virtual caspar_exception {};
12 void catch_fpe(int signum)
14 CASPAR_THROW_EXCEPTION(floating_point_exception());
17 void catch_segv(int signum)
19 CASPAR_THROW_EXCEPTION(segmentation_fault_exception());
22 void do_install_handlers()
24 signal(SIGFPE, catch_fpe);
25 signal(SIGSEGV, catch_segv);
28 void install_gpf_handler()
30 ensure_gpf_handler_installed_for_thread();
33 void ensure_gpf_handler_installed_for_thread(
34 const char* thread_description)
36 static auto install = []() { do_install_handlers(); return 0; } ();