From a497645127293f4d8a08216ee0ef6c1dbfe8d65f Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 3 Feb 2023 14:46:45 +0100 Subject: [PATCH] Setup all signal handlers with SA_RESTART flag so interrupted syscalls get auto-restarted and callers don't get or have to handle the EINTR error. --- lib/base/application.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index dc032f4ea84..72b4420c8dc 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -974,6 +974,7 @@ void Application::InstallExceptionHandlers() struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = &Application::SigAbrtHandler; + sa.sa_flags = SA_RESTART; sigaction(SIGABRT, &sa, nullptr); #else /* _WIN32 */ l_DefaultUnhandledExceptionFilter = SetUnhandledExceptionFilter(&Application::SEHUnhandledExceptionFilter); @@ -991,6 +992,7 @@ int Application::Run() struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = &Application::SigUsr1Handler; + sa.sa_flags = SA_RESTART; sigaction(SIGUSR1, &sa, nullptr); #else /* _WIN32 */ SetConsoleCtrlHandler(&Application::CtrlHandler, TRUE);