diff options
| author | Elias Naur <elias.naur@gmail.com> | 2018-05-21 15:33:20 +0200 |
|---|---|---|
| committer | Elias Naur <elias.naur@gmail.com> | 2018-05-21 19:42:49 +0000 |
| commit | 467e15accc95d4e080a8088eaff0aaa28f572c7e (patch) | |
| tree | fea470fddf70186c13884670b078c488d1f1ea73 /src/runtime/sys_darwin_amd64.s | |
| parent | b88276da6626102801a3621839d8f198176816ce (diff) | |
| download | go-467e15accc95d4e080a8088eaff0aaa28f572c7e.tar.xz | |
runtime: use raise instead of pthread_self and pthread_kill
pthread_self and pthread_kill are not safe to call from a signal
handler. In particular, pthread_self fails in iOS when called from
a signal handler context.
Use raise instead; it is signal handler safe and simpler.
Change-Id: I0cbfe25151aed245f55d7b76719ce06dc78c6a75
Reviewed-on: https://go-review.googlesource.com/113877
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/sys_darwin_amd64.s')
| -rw-r--r-- | src/runtime/sys_darwin_amd64.s | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s index 24db7f52cd..8168415932 100644 --- a/src/runtime/sys_darwin_amd64.s +++ b/src/runtime/sys_darwin_amd64.s @@ -590,20 +590,10 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 +TEXT runtime·raise_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP - MOVQ DI, BX // Note: asmcgocall doesn't save anything in BX, so it is ok to clobber it here. - CALL libc_pthread_self(SB) - MOVQ AX, 0(BX) // Save result. - POPQ BP - RET - -TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 - PUSHQ BP - MOVQ SP, BP - MOVQ 8(DI), SI // arg 2 signal - MOVQ 0(DI), DI // arg 1 thread - CALL libc_pthread_kill(SB) + MOVL 0(DI), DI // arg 1 signal + CALL libc_raise(SB) POPQ BP RET |
