diff --git a/src/Backends/Platform/X11.cpp b/src/Backends/Platform/X11.cpp index 1f0cafcf..435e99e3 100644 --- a/src/Backends/Platform/X11.cpp +++ b/src/Backends/Platform/X11.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,8 @@ Visual* xVisual; static XVisualInfo xvisinfo; static unsigned long startTime; +static void nophandler(int signo) {} + bool Backend_Init(void (*drag_and_drop_callback)(const char *path), void (*window_focus_callback)(bool focus)) { // we're ignoring the hell out of focus and drag & drop xDisplay = XOpenDisplay(NULL); @@ -35,6 +38,17 @@ bool Backend_Init(void (*drag_and_drop_callback)(const char *path), void (*windo gettimeofday(&time, NULL); startTime = (time.tv_sec * 1000) + (time.tv_usec / 1000); + // Disable SIGALRM to compensate for thread-unsafe usleep in Solaris + sigset_t mask; + struct sigaction act; + struct sigaction oldact; + act.sa_handler = nophandler; + act.sa_flags = 0; + sigaction(SIGALRM, &act, &oldact); + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + sigprocmask(SIG_BLOCK, &mask, 0); + return true; }