diff options
author | Austin Clements <austin@google.com> | 2019-10-14 15:49:27 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2019-10-26 02:52:30 +0000 |
commit | 42aab4b0af5e50071fa8901a038bdc6f1f42b2ed (patch) | |
tree | c2f38eaeefc0d3ae4164a6adb64c229879e3ebf4 /src/runtime/os2_aix.go | |
parent | 8714e39497dba141ce7ed83c6a18c3c0def66e77 (diff) | |
download | go-42aab4b0af5e50071fa8901a038bdc6f1f42b2ed.tar.gz go-42aab4b0af5e50071fa8901a038bdc6f1f42b2ed.zip |
runtime: M-targeted signals for libc-based OSes
For #10958, #24543.
Change-Id: I82bee63b49e15bd5a53228eb85179814c80437ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/201403
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/os2_aix.go')
-rw-r--r-- | src/runtime/os2_aix.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/runtime/os2_aix.go b/src/runtime/os2_aix.go index 7f69d6d1e3..7c3cb27223 100644 --- a/src/runtime/os2_aix.go +++ b/src/runtime/os2_aix.go @@ -64,6 +64,8 @@ var ( //go:cgo_import_dynamic libpthread_attr_setstackaddr pthread_attr_setstackaddr "libpthread.a/shr_xpg5_64.o" //go:cgo_import_dynamic libpthread_create pthread_create "libpthread.a/shr_xpg5_64.o" //go:cgo_import_dynamic libpthread_sigthreadmask sigthreadmask "libpthread.a/shr_xpg5_64.o" +//go:cgo_import_dynamic libpthread_self pthread_self "libpthread.a/shr_xpg5_64.o" +//go:cgo_import_dynamic libpthread_kill pthread_kill "libpthread.a/shr_xpg5_64.o" //go:linkname libc__Errno libc__Errno //go:linkname libc_clock_gettime libc_clock_gettime @@ -101,6 +103,8 @@ var ( //go:linkname libpthread_attr_setstackaddr libpthread_attr_setstackaddr //go:linkname libpthread_create libpthread_create //go:linkname libpthread_sigthreadmask libpthread_sigthreadmask +//go:linkname libpthread_self libpthread_self +//go:linkname libpthread_kill libpthread_kill var ( //libc @@ -139,7 +143,9 @@ var ( libpthread_attr_setdetachstate, libpthread_attr_setstackaddr, libpthread_create, - libpthread_sigthreadmask libFunc + libpthread_sigthreadmask, + libpthread_self, + libpthread_kill libFunc ) type libFunc uintptr @@ -724,3 +730,14 @@ func sigprocmask(how int32, new, old *sigset) { sigprocmask1(uintptr(how), uintptr(unsafe.Pointer(new)), uintptr(unsafe.Pointer(old))) } + +//go:nosplit +func pthread_self() pthread { + r, _ := syscall0(&libpthread_self) + return pthread(r) +} + +//go:nosplit +func signalM(mp *m, sig int) { + syscall2(&libpthread_kill, uintptr(pthread(mp.procid)), uintptr(sig)) +} |