weston: Add set up SIGUSR1 blocking early using pthread_sigmask()

Xwayland block SIGUSR1 signal for handling this signal. However, if some
weston plugins creates additional threads before xwayland is loaded,
this signal get delivered these threads and causes weston quit.
Therefore, we should set up SIGUSR1 blocking early so that these threads
can inherit the setting when created.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
This commit is contained in:
Tomohito Esaki
2018-09-04 17:18:06 +09:00
parent b1fb00dbcd
commit f59dc1112b
4 changed files with 501 additions and 1 deletions
+10
View File
@@ -2531,6 +2531,8 @@ int main(int argc, char *argv[])
struct weston_seat *seat;
struct wet_compositor wet = { 0 };
int require_input;
sigset_t mask;
int32_t wait_for_debugger = 0;
struct wl_protocol_logger *protologger = NULL;
@@ -2601,6 +2603,14 @@ int main(int argc, char *argv[])
if (!signals[0] || !signals[1] || !signals[2] || !signals[3])
goto out_signals;
/* Xwayland uses SIGUSR1 for communicating with weston. Since some
weston plugins may create additional threads, set up any necessary
signal blocking early so that these threads can inherit the settings
when created. */
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
if (load_configuration(&config, noconfig, config_file) < 0)
goto out_signals;
wet.config = config;