]> Cypherpunks repositories - gostls13.git/commit
runtime: use a pipe to wake up signal_recv on Darwin
authorIan Lance Taylor <iant@golang.org>
Fri, 28 Jun 2019 18:20:15 +0000 (11:20 -0700)
committerIan Lance Taylor <iant@golang.org>
Sun, 30 Jun 2019 05:48:31 +0000 (05:48 +0000)
commitc485e8b55918b3b37e6eab47036ab6f16fec226d
treed2c8dfa28092ff8c715c817a9e9574e076906669
parent623d653db7cd2287305347196f7f4742b6b1fb38
runtime: use a pipe to wake up signal_recv on Darwin

The implementation of semaphores, and therefore notes, used on Darwin
is not async-signal-safe. The runtime has one case where a note needs
to be woken up from a signal handler: the call to notewakeup in sigsend.
That notewakeup call is only called on a single note, and it doesn't
need the full functionality of notes: nothing ever does a timed wait on it.
So change that one note to use a different implementation on Darwin,
based on a pipe. This lets the wakeup code use the write call, which is
async-signal-safe.

Fixes #31264

Change-Id: If705072d7a961dd908ea9d639c8d12b222c64806
Reviewed-on: https://go-review.googlesource.com/c/go/+/184169
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
13 files changed:
src/runtime/defs_darwin.go
src/runtime/defs_darwin_386.go
src/runtime/defs_darwin_amd64.go
src/runtime/defs_darwin_arm.go
src/runtime/defs_darwin_arm64.go
src/runtime/os_darwin.go
src/runtime/sigqueue.go
src/runtime/sigqueue_note.go [new file with mode: 0644]
src/runtime/sys_darwin.go
src/runtime/sys_darwin_386.s
src/runtime/sys_darwin_amd64.s
src/runtime/sys_darwin_arm.s
src/runtime/sys_darwin_arm64.s