diff options
author | Joel Sing <joel@sing.id.au> | 2020-08-24 03:13:54 +1000 |
---|---|---|
committer | Joel Sing <joel@sing.id.au> | 2021-01-19 12:49:13 +0000 |
commit | d047c91a6c0f22af00d1c1e770a9d85201392656 (patch) | |
tree | dcd9610ea13b12d5490960e2023a8b237de9d27a /src/runtime/os_openbsd.go | |
parent | 61debffd977889cd3f7f63b4f71d5a8ef1fc604e (diff) | |
download | go-d047c91a6c0f22af00d1c1e770a9d85201392656.tar.gz go-d047c91a6c0f22af00d1c1e770a9d85201392656.zip |
cmd/link,runtime: switch openbsd/amd64 to pthreads
This switches openbsd/amd64 to thread creation via pthreads, rather than doing
direct system calls.
Update #36435
Change-Id: I1105d5c392aa3e4c445d99c8cb80b927712e3529
Reviewed-on: https://go-review.googlesource.com/c/go/+/250180
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/os_openbsd.go')
-rw-r--r-- | src/runtime/os_openbsd.go | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index 490077bc29..61be627c27 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -6,7 +6,6 @@ package runtime import ( "runtime/internal/atomic" - "runtime/internal/sys" "unsafe" ) @@ -48,9 +47,6 @@ func getthrid() int32 func thrkill(tid int32, sig int) //go:noescape -func tfork(param *tforkt, psize uintptr, mm *m, gg *g, fn uintptr) int32 - -//go:noescape func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 //go:noescape @@ -183,36 +179,6 @@ func semawakeup(mp *m) { } } -// May run with m.p==nil, so write barriers are not allowed. -//go:nowritebarrier -func newosproc(mp *m) { - stk := unsafe.Pointer(mp.g0.stack.hi) - if false { - print("newosproc stk=", stk, " m=", mp, " g=", mp.g0, " id=", mp.id, " ostk=", &mp, "\n") - } - - // Stack pointer must point inside stack area (as marked with MAP_STACK), - // rather than at the top of it. - param := tforkt{ - tf_tcb: unsafe.Pointer(&mp.tls[0]), - tf_tid: nil, // minit will record tid - tf_stack: uintptr(stk) - sys.PtrSize, - } - - var oset sigset - sigprocmask(_SIG_SETMASK, &sigset_all, &oset) - ret := tfork(¶m, unsafe.Sizeof(param), mp, mp.g0, funcPC(mstart)) - 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 { - println("runtime: may need to increase max user processes (ulimit -p)") - } - throw("runtime.newosproc") - } -} - func osinit() { ncpu = getncpu() physPageSize = getPageSize() |