Call pthread_sigmask() as early as possible so Xwayland SIGUSR1 is not

caught by threads spawned by shared libraries (like the libMali.so
OpenGL driver).
This commit is contained in:
root 2019-09-03 11:33:27 -07:00
parent e1c4104d02
commit ecdb4d7e08
2 changed files with 15 additions and 1 deletions

View file

@ -214,6 +214,19 @@ void enable_debug_flag(const char *flag) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
// Shared libraries (such as libMali.so, the Mali OpenGL
// driver) may create their own threads. To ensure that
// Xwayland's SIGUSR1 does not hit those threads and kill
// sway, we must call pthread_sigmask() as early as possible.
// See also weston commit
// f59dc1112be50467b7c0f8aeba68f3aa10d36725 which does the
// same thing.
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0; static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0;
static struct option long_options[] = { static struct option long_options[] = {

View file

@ -210,5 +210,6 @@ executable(
include_directories: [sway_inc], include_directories: [sway_inc],
dependencies: sway_deps, dependencies: sway_deps,
link_with: [lib_sway_common], link_with: [lib_sway_common],
install: true install: true,
link_args : '-lpthread'
) )