runtime: loop on EINTR in macOS sigNoteSleep

Fixes #46466

Change-Id: I8fb15d0c8ef7ef6e6fc1b9e0e033d213255fe0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/326778
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Ian Lance Taylor 2021-06-10 15:35:05 -07:00
parent e2dc6dd5c9
commit 77aa209b38

View file

@ -118,10 +118,15 @@ func sigNoteWakeup(*note) {
// sigNoteSleep waits for a note created by sigNoteSetup to be woken.
func sigNoteSleep(*note) {
entersyscallblock()
var b byte
read(sigNoteRead, unsafe.Pointer(&b), 1)
exitsyscall()
for {
var b byte
entersyscallblock()
n := read(sigNoteRead, unsafe.Pointer(&b), 1)
exitsyscall()
if n != -_EINTR {
return
}
}
}
// BSD interface for threading.