aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenny Siegert <bsiegert@gmail.com>2017-04-21 08:48:57 +0000
committerIan Lance Taylor <iant@golang.org>2017-05-31 00:50:43 +0000
commitc6e7cb4a375966f7b034e6dbf439a58ea326104a (patch)
treec3ec9894ebd741cba12a4e3b6b278e862d4994a2 /src
parent708a01fbf40cfd82675923f88dd306ef6eb17114 (diff)
downloadgo-c6e7cb4a375966f7b034e6dbf439a58ea326104a.tar.xz
runtime: work around NetBSD bug in thread creation
Block signals explicitly during lwp_create since blocking via the context does not work. This was originally added in pkgsrc as http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/go/patches/patch-src_runtime_os__netbsd.go?rev=1.1 Fixes #19295. Change-Id: I431e70c047cff446e9cfc20d356f45df98c63487 Reviewed-on: https://go-review.googlesource.com/41350 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/os_netbsd.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go
index c79b50b70b..c26c3c9550 100644
--- a/src/runtime/os_netbsd.go
+++ b/src/runtime/os_netbsd.go
@@ -167,13 +167,23 @@ func newosproc(mp *m, stk unsafe.Pointer) {
var uc ucontextt
getcontext(unsafe.Pointer(&uc))
+ // _UC_SIGMASK does not seem to work here.
+ // It would be nice if _UC_SIGMASK and _UC_STACK
+ // worked so that we could do all the work setting
+ // the sigmask and the stack here, instead of setting
+ // the mask here and the stack in netbsdMstart.
+ // For now do the blocking manually.
uc.uc_flags = _UC_SIGMASK | _UC_CPU
uc.uc_link = nil
uc.uc_sigmask = sigset_all
+ var oset sigset
+ sigprocmask(_SIG_SETMASK, &sigset_all, &oset)
+
lwp_mcontext_init(&uc.uc_mcontext, stk, mp, mp.g0, funcPC(netbsdMstart))
ret := lwp_create(unsafe.Pointer(&uc), 0, unsafe.Pointer(&mp.procid))
+ sigprocmask(_SIG_SETMASK, &oset, nil)
if ret < 0 {
print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n")
if ret == -_EAGAIN {