mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime,cmd/ld: on darwin, create theads using libc
Replace thread creation with calls to the pthread library in libc. Update #17490 Change-Id: I1e19965c45255deb849b059231252fc6a7861d6c Reviewed-on: https://go-review.googlesource.com/108679 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
743fd9171f
commit
b7f1777a70
26 changed files with 1008 additions and 210 deletions
|
|
@ -140,7 +140,7 @@ func tstart_sysvicall(newm *m) uint32
|
|||
|
||||
// May run with m.p==nil, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func newosproc(mp *m, _ unsafe.Pointer) {
|
||||
func newosproc(mp *m) {
|
||||
var (
|
||||
attr pthreadattr
|
||||
oset sigset
|
||||
|
|
@ -152,9 +152,11 @@ func newosproc(mp *m, _ unsafe.Pointer) {
|
|||
if pthread_attr_init(&attr) != 0 {
|
||||
throw("pthread_attr_init")
|
||||
}
|
||||
// Allocate a new 2MB stack.
|
||||
if pthread_attr_setstack(&attr, 0, 0x200000) != 0 {
|
||||
throw("pthread_attr_setstack")
|
||||
}
|
||||
// Read back the allocated stack.
|
||||
if pthread_attr_getstack(&attr, unsafe.Pointer(&mp.g0.stack.hi), &size) != 0 {
|
||||
throw("pthread_attr_getstack")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue