os/signal: add func Ignored(sig Signal) bool

Ignored reports whether sig is currently ignored.

This implementation only works applies on Unix systems for now.  However, at
the moment that is also the case for Ignore() and several other signal
interaction methods, so that seems fair.

Fixes #22497

Change-Id: I7c1b1a5e12373ca5da44709500ff5acedc6f1316
Reviewed-on: https://go-review.googlesource.com/108376
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Adam Azarchs 2018-04-19 19:59:39 -07:00 committed by Ian Lance Taylor
parent 37dd7cd040
commit dfb1b69665
7 changed files with 94 additions and 0 deletions

View file

@ -15,6 +15,7 @@ import (
func signal_disable(uint32)
func signal_enable(uint32)
func signal_ignore(uint32)
func signal_ignored(uint32) bool
func signal_recv() uint32
func loop() {
@ -56,3 +57,7 @@ func disableSignal(sig int) {
func ignoreSignal(sig int) {
signal_ignore(uint32(sig))
}
func signalIgnored(sig int) bool {
return signal_ignored(uint32(sig))
}