diff options
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r-- | src/lib/utils/os_utils.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp index fc401c3c1..fe45ad82f 100644 --- a/src/lib/utils/os_utils.cpp +++ b/src/lib/utils/os_utils.cpp @@ -360,26 +360,17 @@ int OS::run_cpu_instruction_probe(std::function<int ()> probe_fn) if(rc != 0) throw Exception("run_cpu_instruction_probe sigaction failed"); - try - { - rc = ::sigsetjmp(g_sigill_jmp_buf, /*save sigs*/1); + rc = ::sigsetjmp(g_sigill_jmp_buf, /*save sigs*/1); - if(rc == 0) - { - // first call to sigsetjmp - probe_result = probe_fn(); - } - else if(rc == 1) - { - // non-local return from siglongjmp in signal handler: return error - probe_result = -1; - } - else - throw Exception("run_cpu_instruction_probe unexpected sigsetjmp return value"); + if(rc == 0) + { + // first call to sigsetjmp + probe_result = probe_fn(); } - catch(...) + else if(rc == 1) { - probe_result = -2; + // non-local return from siglongjmp in signal handler: return error + probe_result = -1; } // Restore old SIGILL handler, if any @@ -392,14 +383,7 @@ int OS::run_cpu_instruction_probe(std::function<int ()> probe_fn) // Windows SEH __try { - try - { - probe_result = probe_fn(); - } - catch(...) - { - probe_result = -2; - } + probe_result = probe_fn(); } __except(::GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) |