diff options
| author | Adam Azarchs <adam.azarchs@10xgenomics.com> | 2018-04-19 19:59:39 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2018-04-21 04:18:03 +0000 |
| commit | dfb1b696656bd56e10c3085e145fe5f40dc2ba42 (patch) | |
| tree | c15f6e80b89d8399d53c8a345a55293127ec8548 /src/runtime/sigqueue.go | |
| parent | 37dd7cd040e626d5a9c30f2880005643b3a23d22 (diff) | |
| download | go-dfb1b696656bd56e10c3085e145fe5f40dc2ba42.tar.xz | |
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>
Diffstat (limited to 'src/runtime/sigqueue.go')
| -rw-r--r-- | src/runtime/sigqueue.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go index 98331627eb..9f53240954 100644 --- a/src/runtime/sigqueue.go +++ b/src/runtime/sigqueue.go @@ -237,7 +237,16 @@ func signal_ignore(s uint32) { atomic.Store(&sig.ignored[s/32], i) } +// sigInitIgnored marks the signal as already ignored. This is called at +// program start by siginit. +func sigInitIgnored(s uint32) { + i := sig.ignored[s/32] + i |= 1 << (s & 31) + atomic.Store(&sig.ignored[s/32], i) +} + // Checked by signal handlers. +//go:linkname signal_ignored os/signal.signal_ignored func signal_ignored(s uint32) bool { i := atomic.Load(&sig.ignored[s/32]) return i&(1<<(s&31)) != 0 |
