diff options
author | Elias Naur <elias.naur@gmail.com> | 2018-05-01 01:21:02 +0200 |
---|---|---|
committer | Elias Naur <elias.naur@gmail.com> | 2018-05-01 00:37:36 +0000 |
commit | c2fdb42b1632b054d382b05ebfb6cb903dbb9531 (patch) | |
tree | 0c166c4b0a09c848e4e0b50fac8d537d66c834e0 /src/runtime/os_darwin.go | |
parent | 21656d09b710799806aee182856b2a02068609bd (diff) | |
download | go-c2fdb42b1632b054d382b05ebfb6cb903dbb9531.tar.gz go-c2fdb42b1632b054d382b05ebfb6cb903dbb9531.zip |
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>
Diffstat (limited to 'src/runtime/os_darwin.go')
-rw-r--r-- | src/runtime/os_darwin.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 067b7debfa..613725115d 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -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[]; |