runtime: implement darwin raise with pthread_self and pthread_kill

Convert raise from raw syscalls to using the system pthread library.
As a bonus, raise will now target the current thread instead of the
process.

Updates #17490

Change-Id: I2e44f2000bf870e99a5b4dc5ff5e0799fba91bde
Reviewed-on: https://go-review.googlesource.com/110475
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Elias Naur 2018-05-01 01:21:02 +02:00
parent 21656d09b7
commit c2fdb42b16
4 changed files with 85 additions and 11 deletions

View file

@ -540,7 +540,12 @@ func sigtramp(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Point
//go:noescape
func setitimer(mode int32, new, old *itimerval)
func raise(sig uint32)
//go:nosplit
func raise(sig uint32) {
tid := pthread_self()
pthread_kill(tid, int(sig))
}
func raiseproc(sig uint32)
//extern SigTabTT runtime·sigtab[];