• Ian Lance Taylor's avatar
    runtime: use a pipe to wake up signal_recv on Darwin · c485e8b5
    Ian Lance Taylor authored
    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: default avatarRuss Cox <rsc@golang.org>
    c485e8b5
defs_darwin_arm64.go 3.82 KB