From ac24388e5e5bdc129451c074a349a982e1d55ffa Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 26 Sep 2016 11:14:41 -0700 Subject: runtime: merge setting new signal mask in minit All the variants that sets the new signal mask in minit do the same thing, so merge them. This requires an OS-specific sigdelset function; the function already exists for linux, and is now added for other OS's. Change-Id: Ie96f6f02e2cf09c43005085985a078bd9581f670 Reviewed-on: https://go-review.googlesource.com/29771 Run-TryBot: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/runtime/os_linux.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/runtime/os_linux.go') diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index bc0d9f2027..92c3db8616 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -257,22 +257,10 @@ func gettid() uint32 // Called to initialize a new m (including the bootstrap m). // Called on the new thread, cannot allocate memory. func minit() { - // Initialize signal handling. - _g_ := getg() - - minitSignalStack() + minitSignals() // for debuggers, in case cgo created the thread - _g_.m.procid = uint64(gettid()) - - // restore signal mask from m.sigmask and unblock essential signals - nmask := _g_.m.sigmask - for i := range sigtable { - if sigtable[i].flags&_SigUnblock != 0 { - sigdelset(&nmask, i) - } - } - sigprocmask(_SIG_SETMASK, &nmask, nil) + getg().m.procid = uint64(gettid()) } // Called from dropm to undo the effect of an minit. -- cgit v1.3-5-g9baa