[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gameoftrees
Subject:    Re: Bug: tog suspend/continue
From:       Christian Weisgerber <naddy () mips ! inka ! de>
Date:       2020-01-14 17:54:24
Message-ID: 20200114175424.GA65332 () lorvorc ! mips ! inka ! de
[Download RAW message or body]

Stefan Sperling:

> Some debugging with bluhm revealed that ncurses uses SIGTSTP and this
> signal should only be handled by the main thread.
> 
> Is this better?
-snip-

Yes, with this I can no longer break the "log" or "blame" views
with suspend/continue.

> +static const struct got_error *
> +block_signals_used_by_main_thread(void)
> +{
> +	sigset_t sigset;
> +	int errcode;
> +
> +	if (sigemptyset(&sigset) == -1)
> +		return got_error_from_errno("sigemptyset");
> +
> +	/* tog handles SIGWINCH and SIGCONT */
> +	if (sigaddset(&sigset, SIGWINCH) == -1)
> +		return got_error_from_errno("sigaddset");
> +	if (sigaddset(&sigset, SIGCONT) == -1)
> +		return got_error_from_errno("sigaddset");
> +
> +	/* ncurses handles SIGTSTP */
> +	if (sigaddset(&sigset, SIGTSTP) == -1)
> +		return got_error_from_errno("sigaddset");
> +
> +	errcode = pthread_sigmask(SIG_BLOCK, &sigset, NULL);
> +	if (errcode)
> +		return got_error_set_errno(errcode, "pthread_sigmask");
> +
> +	return NULL;
> +}

Makes sense.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic