On Friday, May 21, 2021 at 10:44:01 PM UTC+2 Ian Lance Taylor wrote:

> On Fri, May 21, 2021 at 1:37 PM Manlio Perillo <manlio....@gmail.com> 
> wrote: 
> > 
> > [...]
> > 
> > In https://play.golang.org/p/c88iu09mOgO, the SIGINT signal (via 
> Ctrl-C) is ignored after the call to `signal.Ignore`. 
> > However SIGINT is still ignored after the call to `signal.Reset`. 
>
> That is odd. Would you mind opening an issue with a test case? Thanks. 
>
>
Done.  Thanks to Brian Candler for the example.
 

>
> >> In any case I don't see why your program wants to ignore signals. It 
> >> seems better to catch the signal, restore the terminal, and exit. 
> >> 
> > 
> > In some C/C++ programs I have often see the use sigprocmask: 
> > https://www.gnu.org/software/libc/manual/html_node/Why-Block.html 
>
> Using sigprocmask is not the same as using signal.Ignore. sigprocmask 
> will temporarily block the signal until the old signal mask is 
> restored, at which point the signal will be delivered. signal.Ignore 
> will cause the signal to be ignored completely. That is, 
> signal.Ignore is like using sigaction to change the handler to 
> SIG_IGN. It is not like sigprocmask. 
>
>
I'm curious to know if sigprocmask is safe/convenient to use in a Go 
program.

Thanks
Manlio

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/88cb1b9f-00ea-4539-af51-a02671323333n%40googlegroups.com.

Reply via email to