"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: Bug: tog suspend/continue
To:
gameoftrees@openbsd.org
Date:
Tue, 14 Jan 2020 18:54:24 +0100

Download raw body.

Thread
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